Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test results to reflect that Errors.ElementAfterRest is now re…
…coverable, and that expectedContextual now throws an error message with the expected token. Also, update `packages/babel-parser/test/fixtures/es2015/uncategorised/277/input.js` since it had a different syntax error that was previously not reached since it would first fail on the fact that there was an element after rest. Reviewed by @tolmasky.
- Loading branch information
Showing
54 changed files
with
958 additions
and
91 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
packages/babel-parser/test/fixtures/core/uncategorised/396/options.json
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
packages/babel-parser/test/fixtures/core/uncategorised/396/output.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,49 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, | ||
"errors": [ | ||
"SyntaxError: Rest element must be last element. (1:18)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "FunctionDeclaration", | ||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"t"}, | ||
"name": "t" | ||
}, | ||
"generator": false, | ||
"async": false, | ||
"params": [ | ||
{ | ||
"type": "RestElement", | ||
"start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, | ||
"argument": { | ||
"type": "Identifier", | ||
"start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"rest"}, | ||
"name": "rest" | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"b"}, | ||
"name": "b" | ||
} | ||
], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, | ||
"body": [], | ||
"directives": [] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/babel-parser/test/fixtures/core/uncategorised/555/options.json
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
packages/babel-parser/test/fixtures/core/uncategorised/555/output.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,58 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, | ||
"errors": [ | ||
"SyntaxError: Rest element must be last element. (3:13)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":2}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "FunctionDeclaration", | ||
"start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, | ||
"name": "foo" | ||
}, | ||
"generator": false, | ||
"async": false, | ||
"params": [ | ||
{ | ||
"type": "Identifier", | ||
"start":20,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9},"identifierName":"first"}, | ||
"name": "first" | ||
}, | ||
{ | ||
"type": "RestElement", | ||
"start":31,"end":40,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, | ||
"argument": { | ||
"type": "Identifier", | ||
"start":34,"end":40,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13},"identifierName":"second"}, | ||
"name": "second" | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"start":46,"end":51,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":9},"identifierName":"third"}, | ||
"name": "third" | ||
} | ||
], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start":55,"end":58,"loc":{"start":{"line":5,"column":2},"end":{"line":6,"column":1}}, | ||
"body": [], | ||
"directives": [] | ||
} | ||
}, | ||
{ | ||
"type": "EmptyStatement", | ||
"start":58,"end":59,"loc":{"start":{"line":6,"column":1},"end":{"line":6,"column":2}} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/babel-parser/test/fixtures/es2015/array-rest-spread/invalid-location/options.json
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
packages/babel-parser/test/fixtures/es2015/array-rest-spread/invalid-location/output.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,50 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, | ||
"errors": [ | ||
"SyntaxError: Unexpected trailing comma after rest element. (1:1)" | ||
], | ||
"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":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, | ||
"elements": [ | ||
{ | ||
"type": "RestElement", | ||
"start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}}, | ||
"argument": { | ||
"type": "Identifier", | ||
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, | ||
"name": "a" | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, | ||
"name": "b" | ||
} | ||
] | ||
}, | ||
"right": { | ||
"type": "Identifier", | ||
"start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"c"}, | ||
"name": "c" | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
...ges/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
...ages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/output.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,44 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, | ||
"errors": [ | ||
"SyntaxError: Unexpected trailing comma after rest element. (1:8)" | ||
], | ||
"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": "RestElement", | ||
"start":1,"end":8,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":8}}, | ||
"argument": { | ||
"type": "Identifier", | ||
"start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"rest"}, | ||
"name": "rest" | ||
} | ||
} | ||
], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, | ||
"body": [], | ||
"directives": [] | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
...ges/babel-parser/test/fixtures/es2015/arrow-functions/invalid-rest-in-params/options.json
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
...ages/babel-parser/test/fixtures/es2015/arrow-functions/invalid-rest-in-params/output.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,55 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":8}}, | ||
"errors": [ | ||
"SyntaxError: Rest element must be last element. (3:13)", | ||
"SyntaxError: Unexpected trailing comma after rest element. (3:4)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":8}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":8}}, | ||
"expression": { | ||
"type": "ArrowFunctionExpression", | ||
"start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":7}}, | ||
"id": null, | ||
"generator": false, | ||
"async": false, | ||
"params": [ | ||
{ | ||
"type": "Identifier", | ||
"start":6,"end":11,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":9},"identifierName":"first"}, | ||
"name": "first" | ||
}, | ||
{ | ||
"type": "RestElement", | ||
"start":17,"end":26,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":13}}, | ||
"argument": { | ||
"type": "Identifier", | ||
"start":20,"end":26,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":13},"identifierName":"second"}, | ||
"name": "second" | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"start":32,"end":37,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":9},"identifierName":"third"}, | ||
"name": "third" | ||
} | ||
], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start":43,"end":45,"loc":{"start":{"line":5,"column":5},"end":{"line":5,"column":7}}, | ||
"body": [], | ||
"directives": [] | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-import-from/options.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"sourceType": "module", | ||
"throws": "Unexpected token (1:9)" | ||
} | ||
"throws": "Unexpected token, expected \"from\" (1:9)" | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/babel-parser/test/fixtures/es2015/uncategorised/237/options.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"sourceType": "module", | ||
"throws": "Unexpected token (1:10)" | ||
} | ||
"throws": "Unexpected token, expected \"from\" (1:10)" | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/babel-parser/test/fixtures/es2015/uncategorised/238/options.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"sourceType": "module", | ||
"throws": "Unexpected token (1:19)" | ||
} | ||
"throws": "Unexpected token, expected \"from\" (1:19)" | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/es2015/uncategorised/277/input.js
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 |
---|---|---|
@@ -1 +1 @@ | ||
function f(a, ...b, c) | ||
function f(a, ...b, c) { } |
3 changes: 0 additions & 3 deletions
3
packages/babel-parser/test/fixtures/es2015/uncategorised/277/options.json
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
packages/babel-parser/test/fixtures/es2015/uncategorised/277/output.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,54 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, | ||
"errors": [ | ||
"SyntaxError: Rest element must be last element. (1:18)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "FunctionDeclaration", | ||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, | ||
"name": "f" | ||
}, | ||
"generator": false, | ||
"async": false, | ||
"params": [ | ||
{ | ||
"type": "Identifier", | ||
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"a"}, | ||
"name": "a" | ||
}, | ||
{ | ||
"type": "RestElement", | ||
"start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18}}, | ||
"argument": { | ||
"type": "Identifier", | ||
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"b"}, | ||
"name": "b" | ||
} | ||
}, | ||
{ | ||
"type": "Identifier", | ||
"start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"c"}, | ||
"name": "c" | ||
} | ||
], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, | ||
"body": [], | ||
"directives": [] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/babel-parser/test/fixtures/es2015/uncategorised/283/options.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.