diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 808b286386..74f78c6047 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -212,7 +212,7 @@ export default class ExpressionParser extends LValParser { this.expectPlugin("logicalAssignment"); } if (this.match(tt.eq)) { - node.left = this.toAssignable(left, undefined, "assignment expression"); + node.left = this.toAssignable(left); refExpressionErrors.doubleProto = -1; // reset because double __proto__ is valid in assignment expression } else { node.left = left; @@ -1857,15 +1857,17 @@ export default class ExpressionParser extends LValParser { ): N.ArrowFunctionExpression { this.scope.enter(functionFlags(isAsync, false) | SCOPE_ARROW); this.initFunction(node, isAsync); - const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; const oldYieldPos = this.state.yieldPos; const oldAwaitPos = this.state.awaitPos; + + if (params) { + this.state.maybeInArrowParameters = true; + this.setArrowFunctionParameters(node, params, trailingCommaPos); + } this.state.maybeInArrowParameters = false; this.state.yieldPos = -1; this.state.awaitPos = -1; - - if (params) this.setArrowFunctionParameters(node, params, trailingCommaPos); this.parseFunctionBody(node, true); this.scope.exit(); @@ -1881,12 +1883,7 @@ export default class ExpressionParser extends LValParser { params: N.Expression[], trailingCommaPos: ?number, ): void { - node.params = this.toAssignableList( - params, - true, - "arrow function parameters", - trailingCommaPos, - ); + node.params = this.toAssignableList(params, trailingCommaPos); } parseFunctionBodyAndFinish( diff --git a/packages/babel-parser/src/parser/lval.js b/packages/babel-parser/src/parser/lval.js index 0bb6347cea..51de283f5b 100644 --- a/packages/babel-parser/src/parser/lval.js +++ b/packages/babel-parser/src/parser/lval.js @@ -50,114 +50,89 @@ export default class LValParser extends NodeUtils { // NOTE: There is a corresponding "isAssignable" method in flow.js. // When this one is updated, please check if also that one needs to be updated. - toAssignable( - node: Node, - isBinding: ?boolean, - contextDescription: string, - ): Node { - if (node) { + toAssignable(node: Node): Node { + let parenthesized = undefined; + if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) { + parenthesized = unwrapParenthesizedExpression(node); if ( - (this.options.createParenthesizedExpressions && - node.type === "ParenthesizedExpression") || - node.extra?.parenthesized + parenthesized.type !== "Identifier" && + parenthesized.type !== "MemberExpression" ) { - const parenthesized = unwrapParenthesizedExpression(node); - if ( - parenthesized.type !== "Identifier" && - parenthesized.type !== "MemberExpression" + this.raise(node.start, "Invalid parenthesized assignment pattern"); + } + } + + switch (node.type) { + case "Identifier": + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + break; + + case "ObjectExpression": + node.type = "ObjectPattern"; + for ( + let i = 0, length = node.properties.length, last = length - 1; + i < length; + i++ ) { - this.raise(node.start, "Invalid parenthesized assignment pattern"); - } - } + const prop = node.properties[i]; + const isLast = i === last; + this.toAssignableObjectExpressionProp(prop, isLast); - switch (node.type) { - case "Identifier": - case "ObjectPattern": - case "ArrayPattern": - case "AssignmentPattern": - break; - - case "ObjectExpression": - node.type = "ObjectPattern"; - for ( - let i = 0, length = node.properties.length, last = length - 1; - i < length; - i++ + if ( + isLast && + prop.type === "RestElement" && + node.extra?.trailingComma ) { - const prop = node.properties[i]; - const isLast = i === last; - this.toAssignableObjectExpressionProp(prop, isBinding, isLast); - - if ( - isLast && - prop.type === "RestElement" && - node.extra?.trailingComma - ) { - this.raiseRestNotLast(node.extra.trailingComma); - } + this.raiseRestNotLast(node.extra.trailingComma); } - break; + } + break; - case "ObjectProperty": - this.toAssignable(node.value, isBinding, contextDescription); - break; + case "ObjectProperty": + this.toAssignable(node.value); + break; - case "SpreadElement": { - this.checkToRestConversion(node); + case "SpreadElement": { + this.checkToRestConversion(node); - node.type = "RestElement"; - const arg = node.argument; - this.toAssignable(arg, isBinding, contextDescription); - break; + node.type = "RestElement"; + const arg = node.argument; + this.toAssignable(arg); + break; + } + + case "ArrayExpression": + node.type = "ArrayPattern"; + this.toAssignableList(node.elements, node.extra?.trailingComma); + break; + + case "AssignmentExpression": + if (node.operator !== "=") { + this.raise( + node.left.end, + "Only '=' operator can be used for specifying default value.", + ); } - case "ArrayExpression": - node.type = "ArrayPattern"; - this.toAssignableList( - node.elements, - isBinding, - contextDescription, - node.extra?.trailingComma, - ); - break; + node.type = "AssignmentPattern"; + delete node.operator; + this.toAssignable(node.left); + break; - case "AssignmentExpression": - if (node.operator !== "=") { - this.raise( - node.left.end, - "Only '=' operator can be used for specifying default value.", - ); - } + case "ParenthesizedExpression": + this.toAssignable(((parenthesized: any): Expression)); + break; - node.type = "AssignmentPattern"; - delete node.operator; - this.toAssignable(node.left, isBinding, contextDescription); - break; - - case "ParenthesizedExpression": - node.expression = this.toAssignable( - node.expression, - isBinding, - contextDescription, - ); - break; - - case "MemberExpression": - if (!isBinding) break; - - default: - // We don't know how to deal with this node. It will - // be reported by a later call to checkLVal - } + default: + // We don't know how to deal with this node. It will + // be reported by a later call to checkLVal } return node; } - toAssignableObjectExpressionProp( - prop: Node, - isBinding: ?boolean, - isLast: boolean, - ) { + toAssignableObjectExpressionProp(prop: Node, isLast: boolean) { if (prop.type === "ObjectMethod") { const error = prop.kind === "get" || prop.kind === "set" @@ -168,7 +143,7 @@ export default class LValParser extends NodeUtils { } else if (prop.type === "SpreadElement" && !isLast) { this.raiseRestNotLast(prop.start); } else { - this.toAssignable(prop, isBinding, "object destructuring pattern"); + this.toAssignable(prop); } } @@ -176,8 +151,6 @@ export default class LValParser extends NodeUtils { toAssignableList( exprList: Expression[], - isBinding: ?boolean, - contextDescription: string, trailingCommaPos?: ?number, ): $ReadOnlyArray { let end = exprList.length; @@ -188,7 +161,7 @@ export default class LValParser extends NodeUtils { } else if (last && last.type === "SpreadElement") { last.type = "RestElement"; const arg = last.argument; - this.toAssignable(arg, isBinding, contextDescription); + this.toAssignable(arg); if ( arg.type !== "Identifier" && arg.type !== "MemberExpression" && @@ -208,7 +181,7 @@ export default class LValParser extends NodeUtils { for (let i = 0; i < end; i++) { const elt = exprList[i]; if (elt) { - this.toAssignable(elt, isBinding, contextDescription); + this.toAssignable(elt); if (elt.type === "RestElement") { this.raiseRestNotLast(elt.start); } diff --git a/packages/babel-parser/src/parser/statement.js b/packages/babel-parser/src/parser/statement.js index 76b0eb5ed4..201749356c 100644 --- a/packages/babel-parser/src/parser/statement.js +++ b/packages/babel-parser/src/parser/statement.js @@ -537,10 +537,10 @@ export default class StatementParser extends ExpressionParser { const refExpressionErrors = new ExpressionErrors(); const init = this.parseExpression(true, refExpressionErrors); if (this.match(tt._in) || this.isContextual("of")) { + this.toAssignable(init); const description = this.isContextual("of") ? "for-of statement" : "for-in statement"; - this.toAssignable(init, undefined, description); this.checkLVal(init, undefined, undefined, description); return this.parseForIn(node, init, awaitAt); } else { diff --git a/packages/babel-parser/src/plugins/estree.js b/packages/babel-parser/src/plugins/estree.js index 262e592ce8..6104e61605 100644 --- a/packages/babel-parser/src/plugins/estree.js +++ b/packages/babel-parser/src/plugins/estree.js @@ -362,25 +362,17 @@ export default (superClass: Class): Class => return (node: any); } - toAssignable( - node: N.Node, - isBinding: ?boolean, - contextDescription: string, - ): N.Node { + toAssignable(node: N.Node): N.Node { if (isSimpleProperty(node)) { - this.toAssignable(node.value, isBinding, contextDescription); + this.toAssignable(node.value); return node; } - return super.toAssignable(node, isBinding, contextDescription); + return super.toAssignable(node); } - toAssignableObjectExpressionProp( - prop: N.Node, - isBinding: ?boolean, - isLast: boolean, - ) { + toAssignableObjectExpressionProp(prop: N.Node, isLast: boolean) { if (prop.kind === "get" || prop.kind === "set") { throw this.raise( prop.key.start, @@ -392,7 +384,7 @@ export default (superClass: Class): Class => "Object pattern can't contain methods", ); } else { - super.toAssignableObjectExpressionProp(prop, isBinding, isLast); + super.toAssignableObjectExpressionProp(prop, isLast); } } diff --git a/packages/babel-parser/src/plugins/flow.js b/packages/babel-parser/src/plugins/flow.js index 2ab7604514..29a8c8e69f 100644 --- a/packages/babel-parser/src/plugins/flow.js +++ b/packages/babel-parser/src/plugins/flow.js @@ -1886,8 +1886,6 @@ export default (superClass: Class): Class => // node.params is Expression[] instead of $ReadOnlyArray because it // has not been converted yet. ((node.params: any): N.Expression[]), - true, - "arrow function parameters", node.extra?.trailingComma, ); // Enter scope, as checkParams defines bindings @@ -2091,27 +2089,17 @@ export default (superClass: Class): Class => } } - toAssignable( - node: N.Node, - isBinding: ?boolean, - contextDescription: string, - ): N.Node { + toAssignable(node: N.Node): N.Node { if (node.type === "TypeCastExpression") { - return super.toAssignable( - this.typeCastToParameter(node), - isBinding, - contextDescription, - ); + return super.toAssignable(this.typeCastToParameter(node)); } else { - return super.toAssignable(node, isBinding, contextDescription); + return super.toAssignable(node); } } // turn type casts that we found in function parameter head into type annotated params toAssignableList( exprList: N.Expression[], - isBinding: ?boolean, - contextDescription: string, trailingCommaPos?: ?number, ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { @@ -2120,12 +2108,7 @@ export default (superClass: Class): Class => exprList[i] = this.typeCastToParameter(expr); } } - return super.toAssignableList( - exprList, - isBinding, - contextDescription, - trailingCommaPos, - ); + return super.toAssignableList(exprList, trailingCommaPos); } // this is a list of nodes, from something like a call expression, we need to filter the diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index 08691c5b90..c8c7d60ce3 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -2392,31 +2392,19 @@ export default (superClass: Class): Class => return param; } - toAssignable( - node: N.Node, - isBinding: ?boolean, - contextDescription: string, - ): N.Node { + toAssignable(node: N.Node): N.Node { switch (node.type) { case "TSTypeCastExpression": - return super.toAssignable( - this.typeCastToParameter(node), - isBinding, - contextDescription, - ); + return super.toAssignable(this.typeCastToParameter(node)); case "TSParameterProperty": - return super.toAssignable(node, isBinding, contextDescription); + return super.toAssignable(node); case "TSAsExpression": case "TSNonNullExpression": case "TSTypeAssertion": - node.expression = this.toAssignable( - node.expression, - isBinding, - contextDescription, - ); + node.expression = this.toAssignable(node.expression); return node; default: - return super.toAssignable(node, isBinding, contextDescription); + return super.toAssignable(node); } } @@ -2524,10 +2512,7 @@ export default (superClass: Class): Class => } } - toAssignableList( - exprList: N.Expression[], - isBinding: ?boolean, - ): $ReadOnlyArray { + toAssignableList(exprList: N.Expression[]): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; if (!expr) continue; @@ -2537,7 +2522,7 @@ export default (superClass: Class): Class => break; case "TSAsExpression": case "TSTypeAssertion": - if (!isBinding) { + if (!this.state.maybeInArrowParameters) { exprList[i] = this.typeCastToParameter(expr); } else { this.raise( diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/562/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/562/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/input.js diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/556/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/options.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/562/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/562/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2/output.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/561/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/561/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/input.js diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/557/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/557/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/options.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/561/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/561/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3/output.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/560/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/560/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/input.js diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/558/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/options.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/560/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/560/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4/output.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/559/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/559/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/input.js diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/559/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/559/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/options.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/559/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/559/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5/output.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/558/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/558/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/input.js diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/560/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/560/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/options.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/558/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/558/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6/output.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/556/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/556/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/input.js diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/561/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/561/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/options.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/556/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/556/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern/output.json diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/input.js new file mode 100644 index 0000000000..0c1c60bc67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/input.js @@ -0,0 +1 @@ +(!a) += 1 diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/562/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/562/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/options.json diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/output.json new file mode 100644 index 0000000000..a6fd50b790 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side/output.json @@ -0,0 +1,138 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in parenthesized expression (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "operator": "+=", + "left": { + "type": "ParenthesizedExpression", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "UnaryExpression", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "!", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + } + } + }, + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/566/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/566/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/input.js diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/563/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/563/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/options.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/566/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/566/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1/output.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/565/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/565/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/input.js diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/564/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/564/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/options.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/565/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/565/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2/output.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/563/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/563/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/input.js diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/565/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/565/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/options.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/563/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/563/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3/output.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/564/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/564/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/input.js diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/566/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/566/options.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/options.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/564/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/564/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression/output.json diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/557/input.js b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/557/input.js rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/input.js diff --git a/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/options.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/options.json new file mode 100644 index 0000000000..0861962d88 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/557/output.json b/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/uncategorised/557/output.json rename to packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression/output.json