diff --git a/packages/babel-parser/src/parser/lval.js b/packages/babel-parser/src/parser/lval.js index 6db5558a8f..9bb0769294 100644 --- a/packages/babel-parser/src/parser/lval.js +++ b/packages/babel-parser/src/parser/lval.js @@ -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( diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json index 27a7b64d71..2b91be8d51 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:4)" + "throws": "Unexpected keyword 'if' (1:4)" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json index cb6c66081e..f9543317a8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:11)" + "throws": "Unexpected keyword 'if' (1:11)" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json index cb6c66081e..bba7a057d8 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:11)" + "throws": "Unexpected keyword 'true' (1:11)" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json index cb6c66081e..b04b18396a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:11)" + "throws": "Unexpected keyword 'false' (1:11)" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json index cb6c66081e..667f2cc881 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:11)" + "throws": "Unexpected keyword 'null' (1:11)" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json index 27a7b64d71..60a9d5934b 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:4)" + "throws": "Unexpected keyword 'this' (1:4)" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json index 27a7b64d71..5c79fd4f4f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:4)" + "throws": "Unexpected keyword 'super' (1:4)" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json index 27a7b64d71..8a17d90eba 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:4)" + "throws": "Unexpected keyword 'default' (1:4)" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json index 27a7b64d71..8a17d90eba 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:4)" + "throws": "Unexpected keyword 'default' (1:4)" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json index 158f0af7b4..d91e2a5bbc 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:6)" + "throws": "Unexpected keyword 'default' (1:6)" } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json index 27a7b64d71..2b91be8d51 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token (1:4)" + "throws": "Unexpected keyword 'if' (1:4)" } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0104/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0104/input.js deleted file mode 100644 index 9d44939080..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0104/input.js +++ /dev/null @@ -1 +0,0 @@ -function t(if) { } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0104/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0104/options.json deleted file mode 100644 index cb6c66081e..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0104/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0105/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0105/input.js deleted file mode 100644 index d7516ce611..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0105/input.js +++ /dev/null @@ -1 +0,0 @@ -function t(true) { } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0105/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0105/options.json deleted file mode 100644 index cb6c66081e..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0105/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0106/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0106/input.js deleted file mode 100644 index e8edce8239..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0106/input.js +++ /dev/null @@ -1 +0,0 @@ -function t(false) { } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0106/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0106/options.json deleted file mode 100644 index cb6c66081e..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0106/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0107/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0107/input.js deleted file mode 100644 index 86c3d224d0..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0107/input.js +++ /dev/null @@ -1 +0,0 @@ -function t(null) { } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0107/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0107/options.json deleted file mode 100644 index cb6c66081e..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0107/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token (1:11)" -}