Skip to content

Commit

Permalink
Update test results to reflect that Errors.ElementAfterRest is now re…
Browse files Browse the repository at this point in the history
…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
tolmasky committed Jan 14, 2022
1 parent 06a7655 commit 6e475c5
Show file tree
Hide file tree
Showing 54 changed files with 958 additions and 91 deletions.

This file was deleted.

@@ -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": []
}
}

This file was deleted.

@@ -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": []
}
}

This file was deleted.

@@ -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": []
}
}

This file was deleted.

@@ -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": []
}
}

This file was deleted.

@@ -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": []
}
}
@@ -1,4 +1,4 @@
{
"sourceType": "module",
"throws": "Unexpected token (1:9)"
}
"throws": "Unexpected token, expected \"from\" (1:9)"
}
@@ -1,4 +1,4 @@
{
"sourceType": "module",
"throws": "Unexpected token (1:10)"
}
"throws": "Unexpected token, expected \"from\" (1:10)"
}
@@ -1,4 +1,4 @@
{
"sourceType": "module",
"throws": "Unexpected token (1:19)"
}
"throws": "Unexpected token, expected \"from\" (1:19)"
}
@@ -1 +1 @@
function f(a, ...b, c)
function f(a, ...b, c) { }

This file was deleted.

@@ -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": []
}
}

This file was deleted.

0 comments on commit 6e475c5

Please sign in to comment.