diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 7d92c3c28161..890d01d6e2d0 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -566,7 +566,7 @@ export default class ExpressionParser extends LValParser { ); this.state.yieldOrAwaitInPossibleArrowParameters = oldYOAIPAP; } else { - this.toReferencedList(node.arguments); + this.toReferencedListDeep(node.arguments); // We keep the old value if it isn't null, for cases like // (x = async(yield)) => {} @@ -891,7 +891,14 @@ export default class ExpressionParser extends LValParser { true, refShorthandDefaultPos, ); - this.toReferencedList(node.elements); + if (!this.state.maybeInArrowParameters) { + // This could be an array pattern: + // ([a: string, b: string]) => {} + // In this case, we don't have to call toReferencedList. We will + // call it, if needed, when we are sure that it is a parenthesized + // expression by calling toReferencedListDeep. + this.toReferencedList(node.elements); + } return this.finishNode(node, "ArrayExpression"); case tt.braceL: @@ -1173,10 +1180,10 @@ export default class ExpressionParser extends LValParser { } if (refNeedsArrowPos.start) this.unexpected(refNeedsArrowPos.start); + this.toReferencedListDeep(exprList, /* isParenthesizedExpr */ true); if (exprList.length > 1) { val = this.startNodeAt(innerStartPos, innerStartLoc); val.expressions = exprList; - this.toReferencedList(val.expressions); this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); } else { val = exprList[0]; diff --git a/packages/babel-parser/src/parser/lval.js b/packages/babel-parser/src/parser/lval.js index e6c9065afdb2..5fc48b90d277 100644 --- a/packages/babel-parser/src/parser/lval.js +++ b/packages/babel-parser/src/parser/lval.js @@ -177,11 +177,26 @@ export default class LValParser extends NodeUtils { toReferencedList( exprList: $ReadOnlyArray, - isInParens?: boolean, // eslint-disable-line no-unused-vars + isParenthesizedExpr?: boolean, // eslint-disable-line no-unused-vars ): $ReadOnlyArray { return exprList; } + toReferencedListDeep( + exprList: $ReadOnlyArray, + isParenthesizedExpr?: boolean, + ): $ReadOnlyArray { + this.toReferencedList(exprList, isParenthesizedExpr); + + for (const expr of exprList) { + if (expr && expr.type === "ArrayExpression") { + this.toReferencedListDeep(expr.elements); + } + } + + return exprList; + } + // Parses spread element. parseSpread( diff --git a/packages/babel-parser/src/plugins/flow.js b/packages/babel-parser/src/plugins/flow.js index f628c9d7f1a4..a536bb3d06e5 100644 --- a/packages/babel-parser/src/plugins/flow.js +++ b/packages/babel-parser/src/plugins/flow.js @@ -1977,7 +1977,7 @@ export default (superClass: Class): Class => // type casts that we've found that are illegal in this context toReferencedList( exprList: $ReadOnlyArray, - isInParens?: boolean, + isParenthesizedExpr?: boolean, ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; @@ -1985,7 +1985,7 @@ export default (superClass: Class): Class => expr && expr.type === "TypeCastExpression" && (!expr.extra || !expr.extra.parenthesized) && - (exprList.length > 1 || !isInParens) + (exprList.length > 1 || !isParenthesizedExpr) ) { this.raise( expr.typeAnnotation.start, diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/input.js new file mode 100644 index 000000000000..499e10703f06 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/input.js @@ -0,0 +1 @@ +[a: string]; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json new file mode 100644 index 000000000000..48eabee042d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json @@ -0,0 +1,3 @@ +{ + "throws": "The type cast expression is expected to be wrapped with parenthesis (1:2)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/input.js new file mode 100644 index 000000000000..e71b5b600092 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/input.js @@ -0,0 +1 @@ +([a: string]); \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json new file mode 100644 index 000000000000..a7103f22c3bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json @@ -0,0 +1,3 @@ +{ + "throws": "The type cast expression is expected to be wrapped with parenthesis (1:3)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/input.js new file mode 100644 index 000000000000..21e59fd647b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/input.js @@ -0,0 +1 @@ +([a, [b: string]]); \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json new file mode 100644 index 000000000000..b4110f319b42 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json @@ -0,0 +1,3 @@ +{ + "throws": "The type cast expression is expected to be wrapped with parenthesis (1:7)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/input.js new file mode 100644 index 000000000000..6335f1fb022d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/input.js @@ -0,0 +1 @@ +async ([a: string]); \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json new file mode 100644 index 000000000000..476212d7aaa1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json @@ -0,0 +1,3 @@ +{ + "throws": "The type cast expression is expected to be wrapped with parenthesis (1:9)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/input.js new file mode 100644 index 000000000000..5e04cb830166 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/input.js @@ -0,0 +1 @@ +async ([a, [b: string]]); \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json new file mode 100644 index 000000000000..ddef716c822b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json @@ -0,0 +1,3 @@ +{ + "throws": "The type cast expression is expected to be wrapped with parenthesis (1:13)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/works-in-array-pattern/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/works-in-array-pattern/input.js new file mode 100644 index 000000000000..f1829deaf2e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/works-in-array-pattern/input.js @@ -0,0 +1,14 @@ +([a: string]) => {}; +([a, [b: string]]) => {}; +([a: string] = []) => {}; +({ x: [a: string] }) => {}; + +async ([a: string]) => {}; +async ([a, [b: string]]) => {}; +async ([a: string] = []) => {}; +async ({ x: [a: string] }) => {}; + +let [a: string] = c; +let [a, [b: string]] = c; +let [a: string] = c; +let { x: [a: string] } = c; diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/works-in-array-pattern/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/works-in-array-pattern/output.json new file mode 100644 index 000000000000..6b1de7cf0233 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/works-in-array-pattern/output.json @@ -0,0 +1,1739 @@ +{ + "type": "File", + "start": 0, + "end": 323, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 27 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 323, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 27 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 2, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 3, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 5, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "ExpressionStatement", + "start": 21, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 21, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 22, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ArrayPattern", + "start": 26, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 27, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "b" + }, + "name": "b", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 28, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 30, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + } + ] + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "ExpressionStatement", + "start": 47, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 25 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 47, + "end": 71, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 48, + "end": 64, + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "left": { + "type": "ArrayPattern", + "start": 48, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 49, + "end": 58, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 50, + "end": 58, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 52, + "end": 58, + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + } + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 62, + "end": 64, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "elements": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 69, + "end": 71, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "ExpressionStatement", + "start": 73, + "end": 100, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 27 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 73, + "end": 99, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 74, + "end": 92, + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 76, + "end": 90, + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 76, + "end": 77, + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 79, + "end": 90, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 80, + "end": 89, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 81, + "end": 89, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 83, + "end": 89, + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 16 + } + } + } + } + } + ] + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 97, + "end": 99, + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 26 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "ExpressionStatement", + "start": 102, + "end": 128, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 102, + "end": 127, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 25 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "ArrayPattern", + "start": 109, + "end": 120, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 110, + "end": 119, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 17 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 111, + "end": 119, + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 17 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 113, + "end": 119, + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 17 + } + } + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 125, + "end": 127, + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "ExpressionStatement", + "start": 129, + "end": 160, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 31 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 129, + "end": 159, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 30 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "ArrayPattern", + "start": 136, + "end": 152, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 23 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 137, + "end": 138, + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ArrayPattern", + "start": 140, + "end": 151, + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 22 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 141, + "end": 150, + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 21 + }, + "identifierName": "b" + }, + "name": "b", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 142, + "end": 150, + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 21 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 144, + "end": 150, + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 21 + } + } + } + } + } + ] + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 157, + "end": 159, + "loc": { + "start": { + "line": 7, + "column": 28 + }, + "end": { + "line": 7, + "column": 30 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "ExpressionStatement", + "start": 161, + "end": 192, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 31 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 161, + "end": 191, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 30 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 168, + "end": 184, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 23 + } + }, + "left": { + "type": "ArrayPattern", + "start": 168, + "end": 179, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 169, + "end": 178, + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 17 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 170, + "end": 178, + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 17 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 172, + "end": 178, + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 17 + } + } + } + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 182, + "end": 184, + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 23 + } + }, + "elements": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 189, + "end": 191, + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 30 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "ExpressionStatement", + "start": 193, + "end": 226, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 33 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 193, + "end": 225, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 32 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "ObjectPattern", + "start": 200, + "end": 218, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 25 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 202, + "end": 216, + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 23 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 202, + "end": 203, + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 205, + "end": 216, + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 23 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 206, + "end": 215, + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 22 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 207, + "end": 215, + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 22 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 209, + "end": 215, + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 22 + } + } + } + } + } + ] + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 223, + "end": 225, + "loc": { + "start": { + "line": 9, + "column": 30 + }, + "end": { + "line": 9, + "column": 32 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "VariableDeclaration", + "start": 228, + "end": 248, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 232, + "end": 247, + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 19 + } + }, + "id": { + "type": "ArrayPattern", + "start": 232, + "end": 243, + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 15 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 233, + "end": 242, + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 14 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 234, + "end": 242, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 14 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 236, + "end": 242, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 14 + } + } + } + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 246, + "end": 247, + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 19 + }, + "identifierName": "c" + }, + "name": "c" + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 249, + "end": 274, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 253, + "end": 273, + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 24 + } + }, + "id": { + "type": "ArrayPattern", + "start": 253, + "end": 269, + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 20 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 254, + "end": 255, + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ArrayPattern", + "start": 257, + "end": 268, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 19 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 258, + "end": 267, + "loc": { + "start": { + "line": 12, + "column": 9 + }, + "end": { + "line": 12, + "column": 18 + }, + "identifierName": "b" + }, + "name": "b", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 259, + "end": 267, + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 18 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 261, + "end": 267, + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 18 + } + } + } + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 272, + "end": 273, + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + }, + "identifierName": "c" + }, + "name": "c" + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 275, + "end": 295, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 279, + "end": 294, + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 19 + } + }, + "id": { + "type": "ArrayPattern", + "start": 279, + "end": 290, + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 15 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 280, + "end": 289, + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 14 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 281, + "end": 289, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 14 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 283, + "end": 289, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 14 + } + } + } + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 293, + "end": 294, + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 13, + "column": 19 + }, + "identifierName": "c" + }, + "name": "c" + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 296, + "end": 323, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 300, + "end": 322, + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 26 + } + }, + "id": { + "type": "ObjectPattern", + "start": 300, + "end": 318, + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 22 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 302, + "end": 316, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 20 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 302, + "end": 303, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 305, + "end": 316, + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 20 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 306, + "end": 315, + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 19 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 307, + "end": 315, + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 19 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 309, + "end": 315, + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 19 + } + } + } + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 321, + "end": 322, + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 26 + }, + "identifierName": "c" + }, + "name": "c" + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file