Disallow const let or let let
This commit is contained in:
@@ -907,7 +907,7 @@ export default class StatementParser extends ExpressionParser {
|
||||
node.kind = kind;
|
||||
for (;;) {
|
||||
const decl = this.startNode();
|
||||
this.parseVarHead(decl);
|
||||
this.parseVarId(decl, kind);
|
||||
if (this.eat(tt.eq)) {
|
||||
decl.init = this.parseMaybeAssign(isFor);
|
||||
} else {
|
||||
@@ -937,7 +937,10 @@ export default class StatementParser extends ExpressionParser {
|
||||
return node;
|
||||
}
|
||||
|
||||
parseVarHead(decl: N.VariableDeclarator): void {
|
||||
parseVarId(decl: N.VariableDeclarator, kind: "var" | "let" | "const"): void {
|
||||
if ((kind === "const" || kind === "let") && this.isContextual("let")) {
|
||||
this.unexpected(null, "let is disallowed as a lexically bound name");
|
||||
}
|
||||
decl.id = this.parseBindingAtom();
|
||||
this.checkLVal(decl.id, true, undefined, "variable declaration");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user