From fd9ca7c6a8e303d7938bc5e31214d2d970842775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Sat, 24 Aug 2019 15:36:11 +0200 Subject: [PATCH] Do not report invalid lhs in toAssignable --- packages/babel-parser/src/parser/lval.js | 51 +++++++++++++++--- packages/babel-parser/src/plugins/flow.js | 54 ++++++++----------- .../core/uncategorised/367/output.json | 1 - .../core/uncategorised/368/output.json | 1 - .../core/uncategorised/369/output.json | 1 - .../core/uncategorised/374/output.json | 1 - .../core/uncategorised/383/output.json | 1 - .../core/uncategorised/384/output.json | 1 - .../core/uncategorised/417/output.json | 1 - .../core/uncategorised/418/output.json | 1 - .../es2015/uncategorised/221/output.json | 1 - .../es2015/uncategorised/222/output.json | 1 - .../es2015/uncategorised/251/output.json | 1 - .../es2015/uncategorised/252/output.json | 2 - .../es2015/uncategorised/284/output.json | 1 - .../es2015/uncategorised/37/output.json | 1 - .../es2015/uncategorised/395/output.json | 1 - .../output.json | 1 - .../output.json | 1 - .../output.json | 1 - .../output.json | 1 - .../output.json | 1 - .../output.json | 1 - .../invalid-lhs-01/output.json | 1 - .../invalid-lhs-02/output.json | 1 - .../invalid-group-assignment/output.json | 1 - .../invalid-lhs-init/output.json | 1 - .../output.json | 1 - .../output.json | 1 - .../invalid-syntax/migrated_0045/output.json | 1 - .../invalid-syntax/migrated_0046/output.json | 1 - .../invalid-syntax/migrated_0047/output.json | 1 - .../invalid-syntax/migrated_0056/output.json | 1 - .../invalid-syntax/migrated_0066/output.json | 1 - .../invalid-syntax/migrated_0067/output.json | 1 - .../invalid-syntax/migrated_0098/output.json | 1 - .../invalid-syntax/migrated_0099/output.json | 2 - .../invalid-syntax/migrated_0125/output.json | 1 - .../invalid-syntax/migrated_0126/output.json | 1 - .../import-meta/not-assignable/output.json | 1 - .../regression/issue-58-failing-1/output.json | 1 - .../regression/issue-58-failing-2/output.json | 1 - .../regression/issue-58-failing-3/output.json | 1 - .../regression/issue-58-failing-4/output.json | 1 - 44 files changed, 66 insertions(+), 83 deletions(-) diff --git a/packages/babel-parser/src/parser/lval.js b/packages/babel-parser/src/parser/lval.js index 8e2ce05c683e..d8e80e98dcb7 100644 --- a/packages/babel-parser/src/parser/lval.js +++ b/packages/babel-parser/src/parser/lval.js @@ -85,6 +85,7 @@ export default class LValParser extends NodeUtils { if (node.operator === "=") { node.type = "AssignmentPattern"; delete node.operator; + this.toAssignable(node.left, isBinding, contextDescription); } else { this.raise( node.left.end, @@ -104,14 +105,9 @@ export default class LValParser extends NodeUtils { case "MemberExpression": if (!isBinding) break; - default: { - const message = - "Invalid left-hand side" + - (contextDescription - ? " in " + contextDescription - : /* istanbul ignore next */ "expression"); - this.raise(node.start, message); - } + default: + // We don't know to do with this node. It will + // be reported by a later call to checkLVal } } return node; @@ -175,6 +171,45 @@ export default class LValParser extends NodeUtils { return exprList; } + isAssignable(node: Node, isBinding?: boolean) { + switch (node.type) { + case "Identifier": + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + return true; + + case "ObjectExpression": { + const last = node.properties.length - 1; + return node.properties.every((prop, i) => { + return ( + prop.type !== "ObjectMethod" && + (i === last || prop.type === "SpreadElement") && + this.isAssignable(prop) + ); + }); + } + + case "ObjectProperty": + return this.isAssignable(node.value); + + case "SpreadElement": + return this.isAssignable(node.argument); + + case "ArrayExpression": + return node.elements.every(element => this.isAssignable(element)); + + case "AssignmentExpression": + return node.operator === "="; + + case "ParenthesizedExpression": + return this.isAssignable(node.expression); + + case "MemberExpression": + return !isBinding; + } + } + // Convert list of expression atoms to a list of toReferencedList( diff --git a/packages/babel-parser/src/plugins/flow.js b/packages/babel-parser/src/plugins/flow.js index be15eea7fa04..17d1f8ba2882 100644 --- a/packages/babel-parser/src/plugins/flow.js +++ b/packages/babel-parser/src/plugins/flow.js @@ -1735,10 +1735,10 @@ export default (superClass: Class): Class => this.state.noArrowAt = noArrowAt.concat(valid[0].start); ({ consequent, failed } = this.tryParseConditionalConsequent()); } - - this.getArrowLikeExpressions(consequent, true); } + this.getArrowLikeExpressions(consequent, true); + this.state.noArrowAt = originalNoArrowAt; this.expect(tt.colon); @@ -1784,18 +1784,7 @@ export default (superClass: Class): Class => if (node.type === "ArrowFunctionExpression") { if (node.typeParameters || !node.returnType) { // This is an arrow expression without ambiguity, so check its parameters - this.toAssignableList( - // node.params is Expression[] instead of $ReadOnlyArray because it - // has not been converted yet. - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - ); - // Enter scope, as checkParams defines bindings - this.scope.enter(functionFlags(false, false) | SCOPE_ARROW); - // Use super's method to force the parameters to be checked - super.checkParams(node, false, true); - this.scope.exit(); + this.finishArrowValidation(node); } else { arrows.push(node); } @@ -1807,26 +1796,29 @@ export default (superClass: Class): Class => } if (disallowInvalid) { - for (let i = 0; i < arrows.length; i++) { - this.toAssignableList( - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - ); - } + arrows.forEach(node => this.finishArrowValidation(node)); return [arrows, []]; } - return partition(arrows, node => { - const result = this.tryParse(() => - this.toAssignableList( - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - ), - ); - return !result.error; - }); + return partition(arrows, node => + node.params.every(param => this.isAssignable(param, true)), + ); + } + + finishArrowValidation(node: N.ArrowFunctionExpression) { + this.toAssignableList( + // node.params is Expression[] instead of $ReadOnlyArray because it + // has not been converted yet. + ((node.params: any): N.Expression[]), + true, + "arrow function parameters", + true, + ); + // Enter scope, as checkParams defines bindings + this.scope.enter(functionFlags(false, false) | SCOPE_ARROW); + // Use super's method to force the parameters to be checked + super.checkParams(node, false, true); + this.scope.exit(); } forwardNoArrowParamsConversionAt(node: N.Node, parse: () => T): T { diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json index 466f4bd92254..99a3e74a04af 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:0)", "SyntaxError: Invalid left-hand side in assignment expression (1:0)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json index 8a8d67a80a10..8770df4abba7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:0)", "SyntaxError: Invalid left-hand side in assignment expression (1:0)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json index b22f988e1aa7..42614106f157 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:1)", "SyntaxError: Invalid left-hand side in assignment expression (1:1)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json index d2ba76398677..f9e5df01e76a 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in for-in statement (1:5)", "SyntaxError: Invalid left-hand side in for-in statement (1:5)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json index 329a2a1e98b7..56547ff7be13 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:0)", "SyntaxError: Invalid left-hand side in assignment expression (1:0)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json index 12ab663d4186..ece139488ea0 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:0)", "SyntaxError: Invalid left-hand side in assignment expression (1:0)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json index 9210a772c6e1..3844a4d151a7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in for-in statement (1:5)", "SyntaxError: Invalid left-hand side in for-in statement (1:5)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json index 7300952311c2..9d008175f644 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in for-in statement (1:5)", "SyntaxError: Invalid left-hand side in for-in statement (1:5)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json index 6932acaf94d1..58fa4ffd7fb9 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:1)", "SyntaxError: Invalid left-hand side in array destructuring pattern (1:1)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json index 3b566923a758..e758dffee7fa 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in object destructuring pattern (1:7)", "SyntaxError: Invalid left-hand side in object destructuring pattern (1:7)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json index ac99cb69ad3c..a65f6e201960 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (1:1)", "SyntaxError: Binding invalid left-hand side in function paramter list (1:1)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json index 40ac21aa1966..3247dfab9aca 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json @@ -13,8 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (1:1)", - "SyntaxError: Invalid left-hand side in arrow function parameters (1:5)", "SyntaxError: Binding invalid left-hand side in function paramter list (1:1)", "SyntaxError: Binding invalid left-hand side in function paramter list (1:5)" ], diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json index 05a6a4bba833..68f6ccb7cefc 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (1:3)", "SyntaxError: Binding invalid left-hand side in array destructuring pattern (1:3)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json index 0f0e4be597a6..074d84652acc 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (1:2)", "SyntaxError: Binding member expression (1:2)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json index 0f0e4be597a6..074d84652acc 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (1:2)", "SyntaxError: Binding member expression (1:2)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json index 223d916de0b9..bb551e7c73fa 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json @@ -14,7 +14,6 @@ }, "errors": [ "SyntaxError: Yield cannot be used as name inside a generator function (2:8)", - "SyntaxError: Invalid left-hand side in arrow function parameters (2:8)", "SyntaxError: Binding invalid left-hand side in function paramter list (2:8)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json index db7dd7867d99..5af11cb31e43 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json @@ -14,7 +14,6 @@ }, "errors": [ "SyntaxError: Yield cannot be used as name inside a generator function (2:3)", - "SyntaxError: Invalid left-hand side in arrow function parameters (2:3)", "SyntaxError: Binding invalid left-hand side in function paramter list (2:3)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json index 595c1d116b37..ea07b9ddd785 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json @@ -14,7 +14,6 @@ }, "errors": [ "SyntaxError: Yield cannot be used as name inside a generator function (2:3)", - "SyntaxError: Invalid left-hand side in arrow function parameters (2:3)", "SyntaxError: Binding invalid left-hand side in function paramter list (2:3)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json index c686bc898262..a3fbda8e50f6 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json @@ -14,7 +14,6 @@ }, "errors": [ "SyntaxError: Yield cannot be used as name inside a generator function (2:9)", - "SyntaxError: Invalid left-hand side in arrow function parameters (2:9)", "SyntaxError: Binding invalid left-hand side in function paramter list (2:9)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json index 8eb8960ae355..9e8858777646 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in object destructuring pattern (1:4)", "SyntaxError: Binding member expression (1:4)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json index 2956af5c9a0e..a0f4f6168da6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in object destructuring pattern (1:24)", "SyntaxError: Binding member expression (1:24)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json index 89f16c86c886..b71ec1a70153 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in object destructuring pattern (1:4)", "SyntaxError: Invalid left-hand side in object destructuring pattern (1:4)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json index 43142f71dcd8..0282d2b2a59c 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in object destructuring pattern (1:5)", "SyntaxError: Invalid left-hand side in object destructuring pattern (1:5)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json index 104d3f520ff3..a6616604e7dd 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:1)", "SyntaxError: Invalid left-hand side in assignment expression (1:1)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json index 58a3e4e97f69..bdb80af26d26 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in for-of statement (1:5)", "SyntaxError: Invalid left-hand side in for-of statement (1:5)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json index 42f04be1d970..8f5d9fe4753e 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json @@ -14,7 +14,6 @@ }, "errors": [ "SyntaxError: Yield cannot be used as name inside a generator function (1:16)", - "SyntaxError: Invalid left-hand side in arrow function parameters (1:16)", "SyntaxError: Binding invalid left-hand side in function paramter list (1:16)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json index 37c159971dae..b15336d1d4b2 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json @@ -14,7 +14,6 @@ }, "errors": [ "SyntaxError: Yield cannot be used as name inside a generator function (1:25)", - "SyntaxError: Invalid left-hand side in arrow function parameters (1:25)", "SyntaxError: Binding invalid left-hand side in function paramter list (1:25)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json index 466f4bd92254..99a3e74a04af 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:0)", "SyntaxError: Invalid left-hand side in assignment expression (1:0)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json index 8a8d67a80a10..8770df4abba7 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:0)", "SyntaxError: Invalid left-hand side in assignment expression (1:0)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json index b22f988e1aa7..42614106f157 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:1)", "SyntaxError: Invalid left-hand side in assignment expression (1:1)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json index d2ba76398677..f9e5df01e76a 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in for-in statement (1:5)", "SyntaxError: Invalid left-hand side in for-in statement (1:5)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json index 329a2a1e98b7..56547ff7be13 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:0)", "SyntaxError: Invalid left-hand side in assignment expression (1:0)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json index 12ab663d4186..ece139488ea0 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:0)", "SyntaxError: Invalid left-hand side in assignment expression (1:0)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json index ac99cb69ad3c..a65f6e201960 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (1:1)", "SyntaxError: Binding invalid left-hand side in function paramter list (1:1)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json index 40ac21aa1966..3247dfab9aca 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json @@ -13,8 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (1:1)", - "SyntaxError: Invalid left-hand side in arrow function parameters (1:5)", "SyntaxError: Binding invalid left-hand side in function paramter list (1:1)", "SyntaxError: Binding invalid left-hand side in function paramter list (1:5)" ], diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json index 9210a772c6e1..3844a4d151a7 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in for-in statement (1:5)", "SyntaxError: Invalid left-hand side in for-in statement (1:5)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json index 7300952311c2..9d008175f644 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in for-in statement (1:5)", "SyntaxError: Invalid left-hand side in for-in statement (1:5)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json index 914869881742..7610536beafc 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in assignment expression (1:0)", "SyntaxError: Invalid left-hand side in assignment expression (1:0)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json index 7909cd594b5c..7827ed6b38c9 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (2:11)", "SyntaxError: Binding invalid left-hand side in function paramter list (2:11)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json index ddff720ad8f0..17e5c408ff97 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (2:8)", "SyntaxError: Binding invalid left-hand side in function paramter list (2:8)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json index a6acd924be03..aa1daa139847 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (2:5)", "SyntaxError: Binding invalid left-hand side in function paramter list (2:5)" ], "program": { diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json index 26bfde9bb192..1b4bac901478 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json @@ -13,7 +13,6 @@ } }, "errors": [ - "SyntaxError: Invalid left-hand side in arrow function parameters (2:11)", "SyntaxError: Binding invalid left-hand side in function paramter list (2:11)" ], "program": {