fix: disallow all parenthesized pattern except parsing LHS (#12327)
* fix: disallow all parenthesized pattern except parsing LHS * fix: forStatement requires LHS * simplify toAssignable * add more test cases * fix: pass through isLHS on object property and assignment expression * fix: record parenthesized identifier error for LHS * remove duplicated skipped tests * fix: do not record errors on ancestry arrow head * Update packages/babel-parser/src/util/expression-scope.js Co-authored-by: Brian Ng <bng412@gmail.com> Co-authored-by: Brian Ng <bng412@gmail.com>
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
([...(a)]) => {}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:5)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "ArrayPattern",
|
||||
"start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "RestElement",
|
||||
"start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}},
|
||||
"argument": {
|
||||
"type": "ParenthesizedExpression",
|
||||
"start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"},
|
||||
"name": "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"createParenthesizedExpressions": true
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[...(a)] = []
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "RestElement",
|
||||
"start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}},
|
||||
"argument": {
|
||||
"type": "ParenthesizedExpression",
|
||||
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"},
|
||||
"name": "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[...(a.b)] = []
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "RestElement",
|
||||
"start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}},
|
||||
"argument": {
|
||||
"type": "ParenthesizedExpression",
|
||||
"start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}},
|
||||
"expression": {
|
||||
"type": "MemberExpression",
|
||||
"start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"},
|
||||
"name": "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
52
packages/babel-parser/test/fixtures/es2015/arrow-functions/inner-parens-2/output.json
vendored
Normal file
52
packages/babel-parser/test/fixtures/es2015/arrow-functions/inner-parens-2/output.json
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:5)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"b"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 4
|
||||
},
|
||||
"name": "b"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "NumericLiteral",
|
||||
"start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}},
|
||||
"extra": {
|
||||
"rawValue": 42,
|
||||
"raw": "42"
|
||||
},
|
||||
"value": 42
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
([ [(a)] = [] ] = []) => {}
|
||||
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:5)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":1,"end":20,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":20}},
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":1,"end":15,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":15}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":3,"end":13,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":13}},
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":3,"end":8,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":8}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 4
|
||||
},
|
||||
"name": "a"
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
([(a) = [] ] = []) => {}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:3)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":1,"end":17,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":17}},
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 2
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
([(a)]) => {}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:3)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "ArrayPattern",
|
||||
"start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 2
|
||||
},
|
||||
"name": "a"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
({ a: (foo.qux) } = {}) => {}
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"errors": [
|
||||
"SyntaxError: Binding member expression (1:7)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":1,"end":22,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":22}},
|
||||
"left": {
|
||||
"type": "ObjectPattern",
|
||||
"start":1,"end":17,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":17}},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start":3,"end":15,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":15}},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "MemberExpression",
|
||||
"start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 6
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"qux"},
|
||||
"name": "qux"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ObjectExpression",
|
||||
"start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}},
|
||||
"properties": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
({ a: (foo) } = {}) => {}
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:7)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":1,"end":18,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":18}},
|
||||
"left": {
|
||||
"type": "ObjectPattern",
|
||||
"start":1,"end":13,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start":3,"end":11,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":11}},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"foo"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 6
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ObjectExpression",
|
||||
"start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}},
|
||||
"properties": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:11)"
|
||||
}
|
||||
56
packages/babel-parser/test/fixtures/es2015/arrow-functions/inner-parens/output.json
vendored
Normal file
56
packages/babel-parser/test/fixtures/es2015/arrow-functions/inner-parens/output.json
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:12)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15},"identifierName":"foo"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 11
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
(x = ([(f) = []] = [])) => {};
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":1,"end":22,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":22}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":6,"end":21,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":21}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 5
|
||||
},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":6,"end":16,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":16}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":7,"end":15,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":15}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"f"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 7
|
||||
},
|
||||
"name": "f"
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
([(a) = [] ] = []);
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":1,"end":17,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":17}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":2,"end":10,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":10}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 2
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
({ a: (a.b) = (c.d) } = {});
|
||||
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":1,"end":26,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":26}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ObjectPattern",
|
||||
"start":1,"end":21,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":21}},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start":3,"end":19,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":19}},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "AssignmentPattern",
|
||||
"start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}},
|
||||
"left": {
|
||||
"type": "MemberExpression",
|
||||
"start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 6
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"b"},
|
||||
"name": "b"
|
||||
}
|
||||
},
|
||||
"right": {
|
||||
"type": "MemberExpression",
|
||||
"start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 14
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"c"},
|
||||
"name": "c"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"d"},
|
||||
"name": "d"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ObjectExpression",
|
||||
"start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}},
|
||||
"properties": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/es2015/destructuring/lhs-parenthesized-object/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/es2015/destructuring/lhs-parenthesized-object/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
({ a: (a.b) } = {});
|
||||
68
packages/babel-parser/test/fixtures/es2015/destructuring/lhs-parenthesized-object/output.json
vendored
Normal file
68
packages/babel-parser/test/fixtures/es2015/destructuring/lhs-parenthesized-object/output.json
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":1,"end":18,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":18}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ObjectPattern",
|
||||
"start":1,"end":13,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start":3,"end":11,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":11}},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "MemberExpression",
|
||||
"start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 6
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"b"},
|
||||
"name": "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ObjectExpression",
|
||||
"start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}},
|
||||
"properties": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[...(a.b)] = [];
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "RestElement",
|
||||
"start":1,"end":9,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":9}},
|
||||
"argument": {
|
||||
"type": "MemberExpression",
|
||||
"start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 4
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"},
|
||||
"name": "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
(a = function (a) { [(a)] = [0] }) => {}
|
||||
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":1,"end":33,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":33}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"right": {
|
||||
"type": "FunctionExpression",
|
||||
"start":5,"end":33,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":33}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"a"},
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":18,"end":33,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":33}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":20,"end":31,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":31}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"a"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 21
|
||||
},
|
||||
"name": "a"
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}},
|
||||
"extra": {
|
||||
"rawValue": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
"value": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
((a)) => 42
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:1)"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:4)"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
async ([(a) = []] = []) => {}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:9)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":7,"end":22,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":22}},
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":7,"end":17,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":17}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 8
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
async ([ [(a)] = [] ] = []) => {};
|
||||
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:11)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":7,"end":26,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":26}},
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":7,"end":21,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":21}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}},
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 10
|
||||
},
|
||||
"name": "a"
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":17,"end":19,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":19}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":31,"end":33,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":33}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:18)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":10,"end":29,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":29}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"foo"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 17
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
async ([(a.b) = []] = []) => {}
|
||||
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
|
||||
"errors": [
|
||||
"SyntaxError: Binding member expression (1:9)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}},
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}},
|
||||
"left": {
|
||||
"type": "MemberExpression",
|
||||
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 8
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"},
|
||||
"name": "b"
|
||||
}
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
var foo = async ([(foo)]) => {};
|
||||
62
packages/babel-parser/test/fixtures/es2017/async-arrow/parenthesized-binding-pattern/output.json
vendored
Normal file
62
packages/babel-parser/test/fixtures/es2017/async-arrow/parenthesized-binding-pattern/output.json
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:19)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":31,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":31}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":10,"end":31,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":31}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "ArrayPattern",
|
||||
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 18
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
async (x = async([(f) = []])) => {};
|
||||
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":7,"end":28,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":28}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "CallExpression",
|
||||
"start":11,"end":28,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":28}},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"async"},
|
||||
"name": "async"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentExpression",
|
||||
"start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"f"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 18
|
||||
},
|
||||
"name": "f"
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":33,"end":35,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":35}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/es2017/async-arrow/parenthesized-rest-array/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/es2017/async-arrow/parenthesized-rest-array/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var foo = async ([...(foo)]) => {};
|
||||
66
packages/babel-parser/test/fixtures/es2017/async-arrow/parenthesized-rest-array/output.json
vendored
Normal file
66
packages/babel-parser/test/fixtures/es2017/async-arrow/parenthesized-rest-array/output.json
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:22)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":10,"end":34,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":34}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "ArrayPattern",
|
||||
"start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "RestElement",
|
||||
"start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}},
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 21
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/es2017/async-arrow/parenthesized-rest-object/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/es2017/async-arrow/parenthesized-rest-object/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var foo = async ({...(foo)}) => {};
|
||||
66
packages/babel-parser/test/fixtures/es2017/async-arrow/parenthesized-rest-object/output.json
vendored
Normal file
66
packages/babel-parser/test/fixtures/es2017/async-arrow/parenthesized-rest-object/output.json
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:22)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":10,"end":34,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":34}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [
|
||||
{
|
||||
"type": "ObjectPattern",
|
||||
"start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}},
|
||||
"properties": [
|
||||
{
|
||||
"type": "RestElement",
|
||||
"start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}},
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 21
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
async ([(a.b) = [] ] = []);
|
||||
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"},
|
||||
"name": "async"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "AssignmentExpression",
|
||||
"start":7,"end":25,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":25}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":7,"end":20,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":20}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}},
|
||||
"left": {
|
||||
"type": "MemberExpression",
|
||||
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 8
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"},
|
||||
"name": "b"
|
||||
}
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
async ([(a) = [] ] = []);
|
||||
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"},
|
||||
"name": "async"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "AssignmentExpression",
|
||||
"start":7,"end":23,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":23}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":7,"end":18,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":18}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":8,"end":16,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":16}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 8
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-argument-array/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-argument-array/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var foo = async ([(foo)]);
|
||||
55
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-argument-array/output.json
vendored
Normal file
55
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-argument-array/output.json
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":25,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":25}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"init": {
|
||||
"type": "CallExpression",
|
||||
"start":10,"end":25,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":25}},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"async"},
|
||||
"name": "async"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":19,"end":22,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":22},"identifierName":"foo"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 18
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
var foo = async ((foo));
|
||||
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":23,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":23}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"init": {
|
||||
"type": "CallExpression",
|
||||
"start":10,"end":23,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":23}},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"async"},
|
||||
"name": "async"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"foo"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 17
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-call-expression/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-call-expression/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
async ([(a.b) = []] = []);
|
||||
72
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-call-expression/output.json
vendored
Normal file
72
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-call-expression/output.json
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"async"},
|
||||
"name": "async"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "AssignmentExpression",
|
||||
"start":7,"end":24,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":24}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "ArrayPattern",
|
||||
"start":7,"end":19,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":19}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "AssignmentPattern",
|
||||
"start":8,"end":18,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":18}},
|
||||
"left": {
|
||||
"type": "MemberExpression",
|
||||
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 8
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"computed": false,
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"},
|
||||
"name": "b"
|
||||
}
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"type": "ArrayExpression",
|
||||
"start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-spread-array/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-spread-array/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var foo = async ([...(foo)]);
|
||||
59
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-spread-array/output.json
vendored
Normal file
59
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-spread-array/output.json
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":28,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":28}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"init": {
|
||||
"type": "CallExpression",
|
||||
"start":10,"end":28,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":28}},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"async"},
|
||||
"name": "async"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ArrayExpression",
|
||||
"start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}},
|
||||
"elements": [
|
||||
{
|
||||
"type": "SpreadElement",
|
||||
"start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}},
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 21
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-spread-object/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-spread-object/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var foo = async ({...(foo)});
|
||||
59
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-spread-object/output.json
vendored
Normal file
59
packages/babel-parser/test/fixtures/es2017/async-call/parenthesized-spread-object/output.json
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":4,"end":28,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":28}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"init": {
|
||||
"type": "CallExpression",
|
||||
"start":10,"end":28,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":28}},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"async"},
|
||||
"name": "async"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "ObjectExpression",
|
||||
"start":17,"end":27,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":27}},
|
||||
"properties": [
|
||||
{
|
||||
"type": "SpreadElement",
|
||||
"start":18,"end":26,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":26}},
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25},"identifierName":"foo"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 21
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:24)"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:1)"
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:2)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 1
|
||||
},
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "NumericLiteral",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}},
|
||||
"extra": {
|
||||
"rawValue": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
"value": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:1)"
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"errors": [
|
||||
"SyntaxError: Invalid parenthesized assignment pattern (1:2)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"a"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 1
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
{
|
||||
"type": "RestElement",
|
||||
"start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}},
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"b"},
|
||||
"name": "b"
|
||||
}
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "NumericLiteral",
|
||||
"start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}},
|
||||
"extra": {
|
||||
"rawValue": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
"value": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
((a)) => 42
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:1)"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
(a, (b)) => 42
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:4)"
|
||||
}
|
||||
Reference in New Issue
Block a user