forked from jquery/esprima
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ES6: spread element for function argument.
Closes jquery#1169 Closes jquerygh-1200
- Loading branch information
Showing
33 changed files
with
1,433 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f(...x, ...y, ...z); |
178 changes: 178 additions & 0 deletions
178
test/fixtures/ES6/spread-element/call-multi-spread.tree.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
{ | ||
"range": [ | ||
0, | ||
20 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 20 | ||
} | ||
}, | ||
"type": "Program", | ||
"body": [ | ||
{ | ||
"range": [ | ||
0, | ||
20 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 20 | ||
} | ||
}, | ||
"type": "ExpressionStatement", | ||
"expression": { | ||
"range": [ | ||
0, | ||
19 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 19 | ||
} | ||
}, | ||
"type": "CallExpression", | ||
"callee": { | ||
"range": [ | ||
0, | ||
1 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 1 | ||
} | ||
}, | ||
"type": "Identifier", | ||
"name": "f" | ||
}, | ||
"arguments": [ | ||
{ | ||
"range": [ | ||
2, | ||
6 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 6 | ||
} | ||
}, | ||
"type": "SpreadElement", | ||
"argument": { | ||
"range": [ | ||
5, | ||
6 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 6 | ||
} | ||
}, | ||
"type": "Identifier", | ||
"name": "x" | ||
} | ||
}, | ||
{ | ||
"range": [ | ||
8, | ||
12 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 12 | ||
} | ||
}, | ||
"type": "SpreadElement", | ||
"argument": { | ||
"range": [ | ||
11, | ||
12 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 11 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 12 | ||
} | ||
}, | ||
"type": "Identifier", | ||
"name": "y" | ||
} | ||
}, | ||
{ | ||
"range": [ | ||
14, | ||
18 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 14 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 18 | ||
} | ||
}, | ||
"type": "SpreadElement", | ||
"argument": { | ||
"range": [ | ||
17, | ||
18 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 17 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 18 | ||
} | ||
}, | ||
"type": "Identifier", | ||
"name": "z" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f(g, ...h = i); |
162 changes: 162 additions & 0 deletions
162
test/fixtures/ES6/spread-element/call-spread-default.tree.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
{ | ||
"range": [ | ||
0, | ||
15 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 15 | ||
} | ||
}, | ||
"type": "Program", | ||
"body": [ | ||
{ | ||
"range": [ | ||
0, | ||
15 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 15 | ||
} | ||
}, | ||
"type": "ExpressionStatement", | ||
"expression": { | ||
"range": [ | ||
0, | ||
14 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 14 | ||
} | ||
}, | ||
"type": "CallExpression", | ||
"callee": { | ||
"range": [ | ||
0, | ||
1 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 1 | ||
} | ||
}, | ||
"type": "Identifier", | ||
"name": "f" | ||
}, | ||
"arguments": [ | ||
{ | ||
"range": [ | ||
2, | ||
3 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 3 | ||
} | ||
}, | ||
"type": "Identifier", | ||
"name": "g" | ||
}, | ||
{ | ||
"range": [ | ||
5, | ||
13 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 13 | ||
} | ||
}, | ||
"type": "SpreadElement", | ||
"argument": { | ||
"range": [ | ||
8, | ||
13 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 13 | ||
} | ||
}, | ||
"type": "AssignmentExpression", | ||
"operator": "=", | ||
"left": { | ||
"range": [ | ||
8, | ||
9 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 9 | ||
} | ||
}, | ||
"type": "Identifier", | ||
"name": "h" | ||
}, | ||
"right": { | ||
"range": [ | ||
12, | ||
13 | ||
], | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 12 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 13 | ||
} | ||
}, | ||
"type": "Identifier", | ||
"name": "i" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f(...x, y, z); |
Oops, something went wrong.