Optimize parseBindingAtom code to get better error messages (#9762)

This commit is contained in:
Daniel Tschinder
2019-03-25 14:23:39 -07:00
committed by GitHub
parent d720c6cfff
commit 444daf9224
20 changed files with 13 additions and 33 deletions

View File

@@ -231,9 +231,6 @@ export default class LValParser extends NodeUtils {
// Parses lvalue (assignable) atom.
parseBindingAtom(): Pattern {
switch (this.state.type) {
case tt.name:
return this.parseIdentifier();
case tt.bracketL: {
const node = this.startNode();
this.next();
@@ -243,10 +240,9 @@ export default class LValParser extends NodeUtils {
case tt.braceL:
return this.parseObj(true);
default:
throw this.unexpected();
}
return this.parseIdentifier();
}
parseBindingList(