Allow 'yield' as method name (#2382)

fixes #2381
This commit is contained in:
Thomas Sauer
2017-10-21 08:22:39 +02:00
committed by Alex Lam S.L
parent 6bf5fea008
commit f9c57dfee0
2 changed files with 12 additions and 1 deletions

View File

@@ -102,4 +102,15 @@ describe("Yield", function() {
assert.throws(test(tests[i]), fail, tests[i]);
}
});
it("Should allow yield to be used as class/object property name", function() {
var input = [
'"use strict";',
"({yield:42});",
"({yield(){}});",
"(class{yield(){}});",
"class C{yield(){}}",
].join("");
assert.strictEqual(UglifyJS.minify(input, { compress: false }).code, input);
});
});