Correctly check reserved word for PropertyDefinition: IdentifierReference (#11862)

* fix: check IdentifierReference in PropertyDefinition

* chore: add more test cases

* fix: incorrect test title
This commit is contained in:
Huáng Jùnliàng
2020-07-29 19:40:52 -04:00
committed by GitHub
parent 4ac9c7afe2
commit 01d4625412
18 changed files with 330 additions and 159 deletions

View File

@@ -1785,7 +1785,11 @@ export default class ExpressionParser extends LValParser {
}
if (!prop.computed && prop.key.type === "Identifier") {
this.checkReservedWord(prop.key.name, prop.key.start, true, true);
// PropertyDefinition:
// IdentifierReference
// CoveredInitializedName
// Note: `{ eval } = {}` will be checked in `checkLVal` later.
this.checkReservedWord(prop.key.name, prop.key.start, true, false);
if (isPattern) {
prop.value = this.parseMaybeDefault(