Fix rest parameters with array and objects (#424)

* Fix rest parameters with array and objects

* Add test for array rest  with object

* reuse parseBindingIdentifier
This commit is contained in:
Brian Ng 2017-04-03 15:27:43 -05:00 committed by Daniel Tschinder
parent 22741a8068
commit 14b7f50e51
115 changed files with 10555 additions and 58 deletions

View File

@ -110,7 +110,7 @@ pp.parseSpread = function (refShorthandDefaultPos) {
pp.parseRest = function () {
const node = this.startNode();
this.next();
node.argument = this.parseBindingIdentifier();
node.argument = this.parseBindingAtom();
return this.finishNode(node, "RestElement");
};
@ -123,14 +123,11 @@ pp.parseBindingIdentifier = function () {
};
// Parses lvalue (assignable) atom.
pp.parseBindingAtom = function () {
switch (this.state.type) {
case tt._yield:
if (this.state.strict || this.state.inGenerator) this.unexpected();
// fall-through
case tt.name:
return this.parseIdentifier(true);
return this.parseBindingIdentifier();
case tt.bracketL:
const node = this.startNode();

View File

@ -0,0 +1 @@
var [...{length}] = [ 1, 2, 3];

View File

@ -0,0 +1,248 @@
{
"type": "File",
"start": 0,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 31
}
},
"program": {
"type": "Program",
"start": 0,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 31
}
},
"sourceType": "script",
"body": [
{
"type": "VariableDeclaration",
"start": 0,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 31
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 4,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 30
}
},
"id": {
"type": "ArrayPattern",
"start": 4,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 17
}
},
"elements": [
{
"type": "RestElement",
"start": 5,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 16
}
},
"argument": {
"type": "ObjectPattern",
"start": 8,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 16
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 9,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 9,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "length"
},
"name": "length"
},
"value": {
"type": "Identifier",
"start": 9,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "length"
},
"name": "length"
},
"extra": {
"shorthand": true
}
}
]
}
}
]
},
"init": {
"type": "ArrayExpression",
"start": 20,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 30
}
},
"elements": [
{
"type": "NumericLiteral",
"start": 22,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 23
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
},
{
"type": "NumericLiteral",
"start": 25,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 26
}
},
"extra": {
"rawValue": 2,
"raw": "2"
},
"value": 2
},
{
"type": "NumericLiteral",
"start": 28,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 28
},
"end": {
"line": 1,
"column": 29
}
},
"extra": {
"rawValue": 3,
"raw": "3"
},
"value": 3
}
]
}
}
],
"kind": "var"
}
],
"directives": []
}
}

View File

@ -0,0 +1,154 @@
{
"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",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 25
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "x"
},
"name": "x"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 11,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 22
}
},
"argument": {
"type": "ArrayPattern",
"start": 14,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 22
}
},
"elements": [
{
"type": "Identifier",
"start": 16,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 19,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 20
},
"identifierName": "b"
},
"name": "b"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 23,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 25
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:14)"
}

View File

@ -0,0 +1,436 @@
{
"type": "File",
"start": 0,
"end": 54,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 54
}
},
"program": {
"type": "Program",
"start": 0,
"end": 54,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 54
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 54,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 54
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "x"
},
"name": "x"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "ObjectPattern",
"start": 11,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 37
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 13,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 24
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 13,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "a"
},
"name": "a"
},
"value": {
"type": "ObjectPattern",
"start": 16,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 24
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 18,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 19
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 18,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 19
},
"identifierName": "w"
},
"name": "w"
},
"value": {
"type": "Identifier",
"start": 18,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 19
},
"identifierName": "w"
},
"name": "w"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 21,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 22
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 21,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 22
},
"identifierName": "x"
},
"name": "x"
},
"value": {
"type": "Identifier",
"start": 21,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 22
},
"identifierName": "x"
},
"name": "x"
},
"extra": {
"shorthand": true
}
}
]
}
},
{
"type": "ObjectProperty",
"start": 26,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 35
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 26,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 27
},
"identifierName": "b"
},
"name": "b"
},
"value": {
"type": "ArrayPattern",
"start": 29,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 35
}
},
"elements": [
{
"type": "Identifier",
"start": 30,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 30
},
"end": {
"line": 1,
"column": 31
},
"identifierName": "y"
},
"name": "y"
},
{
"type": "Identifier",
"start": 33,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 34
},
"identifierName": "z"
},
"name": "z"
}
]
}
}
]
},
{
"type": "RestElement",
"start": 39,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 39
},
"end": {
"line": 1,
"column": 51
}
},
"argument": {
"type": "ArrayPattern",
"start": 42,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 42
},
"end": {
"line": 1,
"column": 51
}
},
"elements": [
{
"type": "Identifier",
"start": 43,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 43
},
"end": {
"line": 1,
"column": 44
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 46,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 46
},
"end": {
"line": 1,
"column": 47
},
"identifierName": "b"
},
"name": "b"
},
{
"type": "Identifier",
"start": 49,
"end": 50,
"loc": {
"start": {
"line": 1,
"column": 49
},
"end": {
"line": 1,
"column": 50
},
"identifierName": "c"
},
"name": "c"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 52,
"end": 54,
"loc": {
"start": {
"line": 1,
"column": 52
},
"end": {
"line": 1,
"column": 54
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:42)"
}

View File

@ -0,0 +1,173 @@
{
"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",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 27
}
},
"expression": {
"type": "FunctionExpression",
"start": 1,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 26
}
},
"id": {
"type": "Identifier",
"start": 10,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "x"
},
"name": "x"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 12,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 23
}
},
"argument": {
"type": "ArrayPattern",
"start": 15,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 23
}
},
"elements": [
{
"type": "Identifier",
"start": 17,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "a"
},
"name": "a"
},
{
"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": 24,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 26
}
},
"body": [],
"directives": []
},
"extra": {
"parenthesized": true,
"parenStart": 0
}
}
}
],
"directives": []
}
}

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:15)"
}

View File

@ -0,0 +1,455 @@
{
"type": "File",
"start": 0,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 56
}
},
"program": {
"type": "Program",
"start": 0,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 56
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 56
}
},
"expression": {
"type": "FunctionExpression",
"start": 1,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 55
}
},
"id": {
"type": "Identifier",
"start": 10,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "x"
},
"name": "x"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "ObjectPattern",
"start": 12,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 38
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 14,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 25
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 14,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "a"
},
"name": "a"
},
"value": {
"type": "ObjectPattern",
"start": 17,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 25
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 19,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 20
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 19,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 20
},
"identifierName": "w"
},
"name": "w"
},
"value": {
"type": "Identifier",
"start": 19,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 20
},
"identifierName": "w"
},
"name": "w"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 22,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 23
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 22,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 23
},
"identifierName": "x"
},
"name": "x"
},
"value": {
"type": "Identifier",
"start": 22,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 23
},
"identifierName": "x"
},
"name": "x"
},
"extra": {
"shorthand": true
}
}
]
}
},
{
"type": "ObjectProperty",
"start": 27,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 36
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 27,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 28
},
"identifierName": "b"
},
"name": "b"
},
"value": {
"type": "ArrayPattern",
"start": 30,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 30
},
"end": {
"line": 1,
"column": 36
}
},
"elements": [
{
"type": "Identifier",
"start": 31,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 32
},
"identifierName": "y"
},
"name": "y"
},
{
"type": "Identifier",
"start": 34,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 35
},
"identifierName": "z"
},
"name": "z"
}
]
}
}
]
},
{
"type": "RestElement",
"start": 40,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 52
}
},
"argument": {
"type": "ArrayPattern",
"start": 43,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 43
},
"end": {
"line": 1,
"column": 52
}
},
"elements": [
{
"type": "Identifier",
"start": 44,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 44
},
"end": {
"line": 1,
"column": 45
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 47,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 47
},
"end": {
"line": 1,
"column": 48
},
"identifierName": "b"
},
"name": "b"
},
{
"type": "Identifier",
"start": 50,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 50
},
"end": {
"line": 1,
"column": 51
},
"identifierName": "c"
},
"name": "c"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 53,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 53
},
"end": {
"line": 1,
"column": 55
}
},
"body": [],
"directives": []
},
"extra": {
"parenthesized": true,
"parenStart": 0
}
}
}
],
"directives": []
}
}

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:43)"
}

View File

@ -0,0 +1,195 @@
{
"type": "File",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"program": {
"type": "Program",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"expression": {
"type": "ObjectExpression",
"start": 1,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 21
}
},
"properties": [
{
"type": "ObjectMethod",
"start": 3,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 19
}
},
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 3,
"end": 4,
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 4
},
"identifierName": "x"
},
"name": "x"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 5,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 16
}
},
"argument": {
"type": "ArrayPattern",
"start": 8,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 16
}
},
"elements": [
{
"type": "Identifier",
"start": 10,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 13,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "b"
},
"name": "b"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 17,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 19
}
},
"body": [],
"directives": []
}
}
],
"extra": {
"parenthesized": true,
"parenStart": 0
}
}
}
],
"directives": []
}
}

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:8)"
}

View File

@ -0,0 +1,477 @@
{
"type": "File",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 51
}
},
"program": {
"type": "Program",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 51
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 51
}
},
"expression": {
"type": "ObjectExpression",
"start": 1,
"end": 50,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 50
}
},
"properties": [
{
"type": "ObjectMethod",
"start": 3,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 48
}
},
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 3,
"end": 4,
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 4
},
"identifierName": "x"
},
"name": "x"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "ObjectPattern",
"start": 5,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 31
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 7,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 18
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 7,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 8
},
"identifierName": "a"
},
"name": "a"
},
"value": {
"type": "ObjectPattern",
"start": 10,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 18
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 12,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 13
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 12,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "w"
},
"name": "w"
},
"value": {
"type": "Identifier",
"start": 12,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "w"
},
"name": "w"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "x"
},
"name": "x"
},
"value": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "x"
},
"name": "x"
},
"extra": {
"shorthand": true
}
}
]
}
},
{
"type": "ObjectProperty",
"start": 20,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 29
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 20,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 21
},
"identifierName": "b"
},
"name": "b"
},
"value": {
"type": "ArrayPattern",
"start": 23,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 29
}
},
"elements": [
{
"type": "Identifier",
"start": 24,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 25
},
"identifierName": "y"
},
"name": "y"
},
{
"type": "Identifier",
"start": 27,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 28
},
"identifierName": "z"
},
"name": "z"
}
]
}
}
]
},
{
"type": "RestElement",
"start": 33,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 45
}
},
"argument": {
"type": "ArrayPattern",
"start": 36,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 45
}
},
"elements": [
{
"type": "Identifier",
"start": 37,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 1,
"column": 38
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 40,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 41
},
"identifierName": "b"
},
"name": "b"
},
{
"type": "Identifier",
"start": 43,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 43
},
"end": {
"line": 1,
"column": 44
},
"identifierName": "c"
},
"name": "c"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 46,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 46
},
"end": {
"line": 1,
"column": 48
}
},
"body": [],
"directives": []
}
}
],
"extra": {
"parenthesized": true,
"parenStart": 0
}
}
}
],
"directives": []
}
}

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:36)"
}

View File

@ -0,0 +1,153 @@
{
"type": "File",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"program": {
"type": "Program",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"expression": {
"type": "ArrowFunctionExpression",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 1,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 10
}
},
"argument": {
"type": "ArrayPattern",
"start": 4,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 10
}
},
"elements": [
{
"type": "Identifier",
"start": 5,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 6
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 8,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 9
},
"identifierName": "b"
},
"name": "b"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 15,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 17
}
},
"body": [],
"directives": []
}
}
}
],
"directives": []
}
}

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:4)"
}

View File

@ -0,0 +1,153 @@
{
"type": "File",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"program": {
"type": "Program",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"expression": {
"type": "ArrowFunctionExpression",
"start": 0,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 17
}
},
"id": null,
"generator": false,
"expression": 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": "RestElement",
"start": 4,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 10
}
},
"argument": {
"type": "ArrayPattern",
"start": 7,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 10
}
},
"elements": [
{
"type": "Identifier",
"start": 8,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 9
},
"identifierName": "b"
},
"name": "b"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 15,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 17
}
},
"body": [],
"directives": []
}
}
}
],
"directives": []
}
}

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:7)"
}

View File

@ -0,0 +1,175 @@
{
"type": "File",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"program": {
"type": "Program",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "x"
},
"name": "x"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 11,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 19
}
},
"argument": {
"type": "ObjectPattern",
"start": 14,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 19
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 16,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 17
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 16,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "a"
},
"name": "a"
},
"value": {
"type": "Identifier",
"start": 16,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "a"
},
"name": "a"
},
"extra": {
"shorthand": true
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 20,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 22
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:14)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:4)"
"throws": "Unexpected token (1:6)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:6)"
"throws": "Argument name clash in strict mode (1:7)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:30)"
}
"throws": "yield is a reserved word (1:30)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:20)"
}
"throws": "yield is a reserved word (1:20)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:47)"
}
"throws": "yield is a reserved word (1:47)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:20)"
}
"throws": "yield is a reserved word (1:20)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:23)"
}
"throws": "yield is a reserved word (1:23)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:28)"
}
"throws": "yield is a reserved word (1:28)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:25)"
}
"throws": "yield is a reserved word (1:25)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:18)"
}
"throws": "yield is a reserved word (1:18)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:18)"
}
"throws": "yield is a reserved word (1:18)"
}

View File

@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:37)"
}
"throws": "yield is a reserved word (1:37)"
}

View File

@ -1 +0,0 @@
function x(...{ a }){}

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:14)"
}

View File

@ -0,0 +1 @@
(a, ...[b]) => c

View File

@ -0,0 +1,153 @@
{
"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",
"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,
"expression": true,
"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": "RestElement",
"start": 4,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 10
}
},
"argument": {
"type": "ArrayPattern",
"start": 7,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 10
}
},
"elements": [
{
"type": "Identifier",
"start": 8,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 9
},
"identifierName": "b"
},
"name": "b"
}
]
}
}
],
"body": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "c"
},
"name": "c"
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
(a, ...{b}) => c

View File

@ -0,0 +1,191 @@
{
"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",
"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,
"expression": true,
"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": "RestElement",
"start": 4,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 10
}
},
"argument": {
"type": "ObjectPattern",
"start": 7,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 10
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 8,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 9
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 8,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 9
},
"identifierName": "b"
},
"name": "b"
},
"value": {
"type": "Identifier",
"start": 8,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 9
},
"identifierName": "b"
},
"name": "b"
},
"extra": {
"shorthand": true
}
}
]
}
}
],
"body": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "c"
},
"name": "c"
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function f(a, ...b) {}

View File

@ -0,0 +1,137 @@
{
"type": "File",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"program": {
"type": "Program",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "f"
},
"name": "f"
},
"generator": false,
"expression": 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"
}
}
],
"body": {
"type": "BlockStatement",
"start": 20,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 22
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
f = function(a, ...b) {}

View File

@ -0,0 +1,169 @@
{
"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",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 24
}
},
"expression": {
"type": "AssignmentExpression",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 24
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 0,
"end": 1,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
},
"identifierName": "f"
},
"name": "f"
},
"right": {
"type": "FunctionExpression",
"start": 4,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 24
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 13,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "RestElement",
"start": 16,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 20
}
},
"argument": {
"type": "Identifier",
"start": 19,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 20
},
"identifierName": "b"
},
"name": "b"
}
}
],
"body": {
"type": "BlockStatement",
"start": 22,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 24
}
},
"body": [],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
x = { set f(...y) {} }

View File

@ -0,0 +1,190 @@
{
"type": "File",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"program": {
"type": "Program",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"expression": {
"type": "AssignmentExpression",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 22
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 0,
"end": 1,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
},
"identifierName": "x"
},
"name": "x"
},
"right": {
"type": "ObjectExpression",
"start": 4,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 22
}
},
"properties": [
{
"type": "ObjectMethod",
"start": 6,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 20
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 10,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "f"
},
"name": "f"
},
"kind": "set",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 12,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 16
}
},
"argument": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "y"
},
"name": "y"
}
}
],
"body": {
"type": "BlockStatement",
"start": 18,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 20
}
},
"body": [],
"directives": []
}
}
]
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
o = { f: function(a, ...b) {} }

View File

@ -0,0 +1,221 @@
{
"type": "File",
"start": 0,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 31
}
},
"program": {
"type": "Program",
"start": 0,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 31
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 0,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 31
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 0,
"end": 1,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
},
"identifierName": "o"
},
"name": "o"
},
"right": {
"type": "ObjectExpression",
"start": 4,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 31
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 6,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 29
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 6,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 7
},
"identifierName": "f"
},
"name": "f"
},
"value": {
"type": "FunctionExpression",
"start": 9,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 29
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 18,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 19
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "RestElement",
"start": 21,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 25
}
},
"argument": {
"type": "Identifier",
"start": 24,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 25
},
"identifierName": "b"
},
"name": "b"
}
}
],
"body": {
"type": "BlockStatement",
"start": 27,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 29
}
},
"body": [],
"directives": []
}
}
}
]
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
x = { method(...test) { } }

View File

@ -0,0 +1,190 @@
{
"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",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 27
}
},
"expression": {
"type": "AssignmentExpression",
"start": 0,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 27
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 0,
"end": 1,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
},
"identifierName": "x"
},
"name": "x"
},
"right": {
"type": "ObjectExpression",
"start": 4,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 27
}
},
"properties": [
{
"type": "ObjectMethod",
"start": 6,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 25
}
},
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 6,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 12
},
"identifierName": "method"
},
"name": "method"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 13,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 20
}
},
"argument": {
"type": "Identifier",
"start": 16,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 20
},
"identifierName": "test"
},
"name": "test"
}
}
],
"body": {
"type": "BlockStatement",
"start": 22,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 25
}
},
"body": [],
"directives": []
}
}
]
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function f(...[a]) {}

View File

@ -0,0 +1,137 @@
{
"type": "File",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"program": {
"type": "Program",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "f"
},
"name": "f"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 11,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 17
}
},
"argument": {
"type": "ArrayPattern",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
}
},
"elements": [
{
"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": 19,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 21
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function f(...{a}) {}

View File

@ -0,0 +1,175 @@
{
"type": "File",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"program": {
"type": "Program",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 21
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
},
"identifierName": "f"
},
"name": "f"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 11,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 17
}
},
"argument": {
"type": "ObjectPattern",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "a"
},
"name": "a"
},
"value": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "a"
},
"name": "a"
},
"extra": {
"shorthand": true
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 19,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 21
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function emptyWithArray(...[[]]) {}

View File

@ -0,0 +1,136 @@
{
"type": "File",
"start": 0,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 35
}
},
"program": {
"type": "Program",
"start": 0,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 35
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 35
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 23
},
"identifierName": "emptyWithArray"
},
"name": "emptyWithArray"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 24,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 31
}
},
"argument": {
"type": "ArrayPattern",
"start": 27,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 31
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 28,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 28
},
"end": {
"line": 1,
"column": 30
}
},
"elements": []
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 33,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 35
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function emptyWithLeading(x, ...[]) {}

View File

@ -0,0 +1,136 @@
{
"type": "File",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"program": {
"type": "Program",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 25
},
"identifierName": "emptyWithLeading"
},
"name": "emptyWithLeading"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 26,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 27
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "RestElement",
"start": 29,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 34
}
},
"argument": {
"type": "ArrayPattern",
"start": 32,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 34
}
},
"elements": []
}
}
],
"body": {
"type": "BlockStatement",
"start": 36,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 38
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function emptyWithObject(...[{}]) {}

View File

@ -0,0 +1,136 @@
{
"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",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 24
},
"identifierName": "emptyWithObject"
},
"name": "emptyWithObject"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 25,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 32
}
},
"argument": {
"type": "ArrayPattern",
"start": 28,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 28
},
"end": {
"line": 1,
"column": 32
}
},
"elements": [
{
"type": "ObjectPattern",
"start": 29,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 31
}
},
"properties": []
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 34,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 36
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function emptyWithRest(...[...[]]) {}

View File

@ -0,0 +1,151 @@
{
"type": "File",
"start": 0,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 37
}
},
"program": {
"type": "Program",
"start": 0,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 37
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 37
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 22
},
"identifierName": "emptyWithRest"
},
"name": "emptyWithRest"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 23,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 33
}
},
"argument": {
"type": "ArrayPattern",
"start": 26,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 33
}
},
"elements": [
{
"type": "RestElement",
"start": 27,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 32
}
},
"argument": {
"type": "ArrayPattern",
"start": 30,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 30
},
"end": {
"line": 1,
"column": 32
}
},
"elements": []
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 35,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 35
},
"end": {
"line": 1,
"column": 37
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function empty(...[]) {}

View File

@ -0,0 +1,119 @@
{
"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",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 24
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "empty"
},
"name": "empty"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 15,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 20
}
},
"argument": {
"type": "ArrayPattern",
"start": 18,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 20
}
},
"elements": []
}
}
],
"body": {
"type": "BlockStatement",
"start": 22,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 24
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function multiElementWithArray(...[[a], b, [c]]) {}

View File

@ -0,0 +1,205 @@
{
"type": "File",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 51
}
},
"program": {
"type": "Program",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 51
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 51
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 30
},
"identifierName": "multiElementWithArray"
},
"name": "multiElementWithArray"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 31,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 47
}
},
"argument": {
"type": "ArrayPattern",
"start": 34,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 47
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 35,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 35
},
"end": {
"line": 1,
"column": 38
}
},
"elements": [
{
"type": "Identifier",
"start": 36,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 37
},
"identifierName": "a"
},
"name": "a"
}
]
},
{
"type": "Identifier",
"start": 40,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 41
},
"identifierName": "b"
},
"name": "b"
},
{
"type": "ArrayPattern",
"start": 43,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 43
},
"end": {
"line": 1,
"column": 46
}
},
"elements": [
{
"type": "Identifier",
"start": 44,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 44
},
"end": {
"line": 1,
"column": 45
},
"identifierName": "c"
},
"name": "c"
}
]
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 49,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 49
},
"end": {
"line": 1,
"column": 51
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function multiElementWithInitializer(...[a = 0, b, c = 1]) {}

View File

@ -0,0 +1,241 @@
{
"type": "File",
"start": 0,
"end": 61,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 61
}
},
"program": {
"type": "Program",
"start": 0,
"end": 61,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 61
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 61,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 61
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 36
},
"identifierName": "multiElementWithInitializer"
},
"name": "multiElementWithInitializer"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 37,
"end": 57,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 1,
"column": 57
}
},
"argument": {
"type": "ArrayPattern",
"start": 40,
"end": 57,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 57
}
},
"elements": [
{
"type": "AssignmentPattern",
"start": 41,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 41
},
"end": {
"line": 1,
"column": 46
}
},
"left": {
"type": "Identifier",
"start": 41,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 41
},
"end": {
"line": 1,
"column": 42
},
"identifierName": "a"
},
"name": "a"
},
"right": {
"type": "NumericLiteral",
"start": 45,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 45
},
"end": {
"line": 1,
"column": 46
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
},
{
"type": "Identifier",
"start": 48,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 48
},
"end": {
"line": 1,
"column": 49
},
"identifierName": "b"
},
"name": "b"
},
{
"type": "AssignmentPattern",
"start": 51,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 51
},
"end": {
"line": 1,
"column": 56
}
},
"left": {
"type": "Identifier",
"start": 51,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 51
},
"end": {
"line": 1,
"column": 52
},
"identifierName": "c"
},
"name": "c"
},
"right": {
"type": "NumericLiteral",
"start": 55,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 55
},
"end": {
"line": 1,
"column": 56
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 59,
"end": 61,
"loc": {
"start": {
"line": 1,
"column": 59
},
"end": {
"line": 1,
"column": 61
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function multiElementWithLeading(x, y, ...[a, b, c]) {}

View File

@ -0,0 +1,205 @@
{
"type": "File",
"start": 0,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 55
}
},
"program": {
"type": "Program",
"start": 0,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 55
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 55
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 32
},
"identifierName": "multiElementWithLeading"
},
"name": "multiElementWithLeading"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 33,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 34
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "Identifier",
"start": 36,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 37
},
"identifierName": "y"
},
"name": "y"
},
{
"type": "RestElement",
"start": 39,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 39
},
"end": {
"line": 1,
"column": 51
}
},
"argument": {
"type": "ArrayPattern",
"start": 42,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 42
},
"end": {
"line": 1,
"column": 51
}
},
"elements": [
{
"type": "Identifier",
"start": 43,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 43
},
"end": {
"line": 1,
"column": 44
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 46,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 46
},
"end": {
"line": 1,
"column": 47
},
"identifierName": "b"
},
"name": "b"
},
{
"type": "Identifier",
"start": 49,
"end": 50,
"loc": {
"start": {
"line": 1,
"column": 49
},
"end": {
"line": 1,
"column": 50
},
"identifierName": "c"
},
"name": "c"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 53,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 53
},
"end": {
"line": 1,
"column": 55
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function multiElementWithObject(...[{p: q}, {r}, {s = 0}]) {}

View File

@ -0,0 +1,368 @@
{
"type": "File",
"start": 0,
"end": 61,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 61
}
},
"program": {
"type": "Program",
"start": 0,
"end": 61,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 61
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 61,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 61
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 31
},
"identifierName": "multiElementWithObject"
},
"name": "multiElementWithObject"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 32,
"end": 57,
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 57
}
},
"argument": {
"type": "ArrayPattern",
"start": 35,
"end": 57,
"loc": {
"start": {
"line": 1,
"column": 35
},
"end": {
"line": 1,
"column": 57
}
},
"elements": [
{
"type": "ObjectPattern",
"start": 36,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 42
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 37,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 1,
"column": 41
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 37,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 1,
"column": 38
},
"identifierName": "p"
},
"name": "p"
},
"value": {
"type": "Identifier",
"start": 40,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 41
},
"identifierName": "q"
},
"name": "q"
}
}
]
},
{
"type": "ObjectPattern",
"start": 44,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 44
},
"end": {
"line": 1,
"column": 47
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 45,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 45
},
"end": {
"line": 1,
"column": 46
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 45,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 45
},
"end": {
"line": 1,
"column": 46
},
"identifierName": "r"
},
"name": "r"
},
"value": {
"type": "Identifier",
"start": 45,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 45
},
"end": {
"line": 1,
"column": 46
},
"identifierName": "r"
},
"name": "r"
},
"extra": {
"shorthand": true
}
}
]
},
{
"type": "ObjectPattern",
"start": 49,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 49
},
"end": {
"line": 1,
"column": 56
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 50,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 50
},
"end": {
"line": 1,
"column": 55
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 50,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 50
},
"end": {
"line": 1,
"column": 51
},
"identifierName": "s"
},
"name": "s"
},
"value": {
"type": "AssignmentPattern",
"start": 50,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 50
},
"end": {
"line": 1,
"column": 55
}
},
"left": {
"type": "Identifier",
"start": 50,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 50
},
"end": {
"line": 1,
"column": 51
},
"identifierName": "s"
},
"name": "s"
},
"right": {
"type": "NumericLiteral",
"start": 54,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 54
},
"end": {
"line": 1,
"column": 55
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
},
"extra": {
"shorthand": true
}
}
]
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 59,
"end": 61,
"loc": {
"start": {
"line": 1,
"column": 59
},
"end": {
"line": 1,
"column": 61
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function multiElementWithRest(...[a, b, ...c]) {}

View File

@ -0,0 +1,186 @@
{
"type": "File",
"start": 0,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 49
}
},
"program": {
"type": "Program",
"start": 0,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 49
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 49
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 29
},
"identifierName": "multiElementWithRest"
},
"name": "multiElementWithRest"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 30,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 30
},
"end": {
"line": 1,
"column": 45
}
},
"argument": {
"type": "ArrayPattern",
"start": 33,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 45
}
},
"elements": [
{
"type": "Identifier",
"start": 34,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 35
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 37,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 1,
"column": 38
},
"identifierName": "b"
},
"name": "b"
},
{
"type": "RestElement",
"start": 40,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 44
}
},
"argument": {
"type": "Identifier",
"start": 43,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 43
},
"end": {
"line": 1,
"column": 44
},
"identifierName": "c"
},
"name": "c"
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 47,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 47
},
"end": {
"line": 1,
"column": 49
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function multiElement(...[a, b, c]) {}

View File

@ -0,0 +1,171 @@
{
"type": "File",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"program": {
"type": "Program",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 21
},
"identifierName": "multiElement"
},
"name": "multiElement"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 22,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 34
}
},
"argument": {
"type": "ArrayPattern",
"start": 25,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 34
}
},
"elements": [
{
"type": "Identifier",
"start": 26,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 27
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 29,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 30
},
"identifierName": "b"
},
"name": "b"
},
{
"type": "Identifier",
"start": 32,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 33
},
"identifierName": "c"
},
"name": "c"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 36,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 38
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function singleElementWithArray(...[[a]]) {}

View File

@ -0,0 +1,154 @@
{
"type": "File",
"start": 0,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 44
}
},
"program": {
"type": "Program",
"start": 0,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 44
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 44
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 31
},
"identifierName": "singleElementWithArray"
},
"name": "singleElementWithArray"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 32,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 40
}
},
"argument": {
"type": "ArrayPattern",
"start": 35,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 35
},
"end": {
"line": 1,
"column": 40
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 36,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 39
}
},
"elements": [
{
"type": "Identifier",
"start": 37,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 1,
"column": 38
},
"identifierName": "a"
},
"name": "a"
}
]
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 42,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 42
},
"end": {
"line": 1,
"column": 44
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function singleElementWithInitializer(...[a = 0]) {}

View File

@ -0,0 +1,172 @@
{
"type": "File",
"start": 0,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 52
}
},
"program": {
"type": "Program",
"start": 0,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 52
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 52
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 37
},
"identifierName": "singleElementWithInitializer"
},
"name": "singleElementWithInitializer"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 38,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 38
},
"end": {
"line": 1,
"column": 48
}
},
"argument": {
"type": "ArrayPattern",
"start": 41,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 41
},
"end": {
"line": 1,
"column": 48
}
},
"elements": [
{
"type": "AssignmentPattern",
"start": 42,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 42
},
"end": {
"line": 1,
"column": 47
}
},
"left": {
"type": "Identifier",
"start": 42,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 42
},
"end": {
"line": 1,
"column": 43
},
"identifierName": "a"
},
"name": "a"
},
"right": {
"type": "NumericLiteral",
"start": 46,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 46
},
"end": {
"line": 1,
"column": 47
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 50,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 50
},
"end": {
"line": 1,
"column": 52
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function singleElementWithLeading(x, ...[a]) {}

View File

@ -0,0 +1,154 @@
{
"type": "File",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 47
}
},
"program": {
"type": "Program",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 47
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 47
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 33
},
"identifierName": "singleElementWithLeading"
},
"name": "singleElementWithLeading"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 34,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 35
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "RestElement",
"start": 37,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 1,
"column": 43
}
},
"argument": {
"type": "ArrayPattern",
"start": 40,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 43
}
},
"elements": [
{
"type": "Identifier",
"start": 41,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 41
},
"end": {
"line": 1,
"column": 42
},
"identifierName": "a"
},
"name": "a"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 45,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 45
},
"end": {
"line": 1,
"column": 47
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function singleElementWithObject(...[{p: q}]) {}

View File

@ -0,0 +1,189 @@
{
"type": "File",
"start": 0,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 48
}
},
"program": {
"type": "Program",
"start": 0,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 48
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 48
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 32
},
"identifierName": "singleElementWithObject"
},
"name": "singleElementWithObject"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 33,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 44
}
},
"argument": {
"type": "ArrayPattern",
"start": 36,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 44
}
},
"elements": [
{
"type": "ObjectPattern",
"start": 37,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 1,
"column": 43
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 38,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 38
},
"end": {
"line": 1,
"column": 42
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 38,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 38
},
"end": {
"line": 1,
"column": 39
},
"identifierName": "p"
},
"name": "p"
},
"value": {
"type": "Identifier",
"start": 41,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 41
},
"end": {
"line": 1,
"column": 42
},
"identifierName": "q"
},
"name": "q"
}
}
]
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 46,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 46
},
"end": {
"line": 1,
"column": 48
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function singleElementWithRest(...[...a]) {}

View File

@ -0,0 +1,152 @@
{
"type": "File",
"start": 0,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 44
}
},
"program": {
"type": "Program",
"start": 0,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 44
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 44
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 30
},
"identifierName": "singleElementWithRest"
},
"name": "singleElementWithRest"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 31,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 40
}
},
"argument": {
"type": "ArrayPattern",
"start": 34,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 40
}
},
"elements": [
{
"type": "RestElement",
"start": 35,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 35
},
"end": {
"line": 1,
"column": 39
}
},
"argument": {
"type": "Identifier",
"start": 38,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 38
},
"end": {
"line": 1,
"column": 39
},
"identifierName": "a"
},
"name": "a"
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 42,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 42
},
"end": {
"line": 1,
"column": 44
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function singleElement(...[a]) {}

View File

@ -0,0 +1,137 @@
{
"type": "File",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"program": {
"type": "Program",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 33
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 22
},
"identifierName": "singleElement"
},
"name": "singleElement"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 23,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 29
}
},
"argument": {
"type": "ArrayPattern",
"start": 26,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 29
}
},
"elements": [
{
"type": "Identifier",
"start": 27,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 28
},
"identifierName": "a"
},
"name": "a"
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 31,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 33
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function emptyWithArray(...{p: []}) {}

View File

@ -0,0 +1,171 @@
{
"type": "File",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"program": {
"type": "Program",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 23
},
"identifierName": "emptyWithArray"
},
"name": "emptyWithArray"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 24,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 34
}
},
"argument": {
"type": "ObjectPattern",
"start": 27,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 34
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 28,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 28
},
"end": {
"line": 1,
"column": 33
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 28,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 28
},
"end": {
"line": 1,
"column": 29
},
"identifierName": "p"
},
"name": "p"
},
"value": {
"type": "ArrayPattern",
"start": 31,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 33
}
},
"elements": []
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 36,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 38
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function emptyWithLeading(x, ...{}) {}

View File

@ -0,0 +1,136 @@
{
"type": "File",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"program": {
"type": "Program",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 25
},
"identifierName": "emptyWithLeading"
},
"name": "emptyWithLeading"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 26,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 27
},
"identifierName": "x"
},
"name": "x"
},
{
"type": "RestElement",
"start": 29,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 34
}
},
"argument": {
"type": "ObjectPattern",
"start": 32,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 34
}
},
"properties": []
}
}
],
"body": {
"type": "BlockStatement",
"start": 36,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 38
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function emptyWithObject(...{p: {}}) {}

View File

@ -0,0 +1,171 @@
{
"type": "File",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 39
}
},
"program": {
"type": "Program",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 39
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 39
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 24
},
"identifierName": "emptyWithObject"
},
"name": "emptyWithObject"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 25,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 35
}
},
"argument": {
"type": "ObjectPattern",
"start": 28,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 28
},
"end": {
"line": 1,
"column": 35
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 29,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 34
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 29,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 30
},
"identifierName": "p"
},
"name": "p"
},
"value": {
"type": "ObjectPattern",
"start": 32,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 34
}
},
"properties": []
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 37,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 1,
"column": 39
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function empty(...{}) {}

View File

@ -0,0 +1,119 @@
{
"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",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 24
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "empty"
},
"name": "empty"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 15,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 20
}
},
"argument": {
"type": "ObjectPattern",
"start": 18,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 20
}
},
"properties": []
}
}
],
"body": {
"type": "BlockStatement",
"start": 22,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 24
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function multiElementWithArray(...{p: [a], b, q: [c]}) {}

View File

@ -0,0 +1,313 @@
{
"type": "File",
"start": 0,
"end": 57,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 57
}
},
"program": {
"type": "Program",
"start": 0,
"end": 57,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 57
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 57,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 57
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 30
},
"identifierName": "multiElementWithArray"
},
"name": "multiElementWithArray"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 31,
"end": 53,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 53
}
},
"argument": {
"type": "ObjectPattern",
"start": 34,
"end": 53,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 53
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 35,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 35
},
"end": {
"line": 1,
"column": 41
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 35,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 35
},
"end": {
"line": 1,
"column": 36
},
"identifierName": "p"
},
"name": "p"
},
"value": {
"type": "ArrayPattern",
"start": 38,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 38
},
"end": {
"line": 1,
"column": 41
}
},
"elements": [
{
"type": "Identifier",
"start": 39,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 39
},
"end": {
"line": 1,
"column": 40
},
"identifierName": "a"
},
"name": "a"
}
]
}
},
{
"type": "ObjectProperty",
"start": 43,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 43
},
"end": {
"line": 1,
"column": 44
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 43,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 43
},
"end": {
"line": 1,
"column": 44
},
"identifierName": "b"
},
"name": "b"
},
"value": {
"type": "Identifier",
"start": 43,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 43
},
"end": {
"line": 1,
"column": 44
},
"identifierName": "b"
},
"name": "b"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 46,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 46
},
"end": {
"line": 1,
"column": 52
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 46,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 46
},
"end": {
"line": 1,
"column": 47
},
"identifierName": "q"
},
"name": "q"
},
"value": {
"type": "ArrayPattern",
"start": 49,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 49
},
"end": {
"line": 1,
"column": 52
}
},
"elements": [
{
"type": "Identifier",
"start": 50,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 50
},
"end": {
"line": 1,
"column": 51
},
"identifierName": "c"
},
"name": "c"
}
]
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 55,
"end": 57,
"loc": {
"start": {
"line": 1,
"column": 55
},
"end": {
"line": 1,
"column": 57
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function multiElementWithInitializer(...{a: r = 0, b: s, c: t = 1}) {}

View File

@ -0,0 +1,346 @@
{
"type": "File",
"start": 0,
"end": 70,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 70
}
},
"program": {
"type": "Program",
"start": 0,
"end": 70,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 70
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 70,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 70
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 36
},
"identifierName": "multiElementWithInitializer"
},
"name": "multiElementWithInitializer"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 37,
"end": 66,
"loc": {
"start": {
"line": 1,
"column": 37
},
"end": {
"line": 1,
"column": 66
}
},
"argument": {
"type": "ObjectPattern",
"start": 40,
"end": 66,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 66
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 41,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 41
},
"end": {
"line": 1,
"column": 49
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 41,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 41
},
"end": {
"line": 1,
"column": 42
},
"identifierName": "a"
},
"name": "a"
},
"value": {
"type": "AssignmentPattern",
"start": 44,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 44
},
"end": {
"line": 1,
"column": 49
}
},
"left": {
"type": "Identifier",
"start": 44,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 44
},
"end": {
"line": 1,
"column": 45
},
"identifierName": "r"
},
"name": "r"
},
"right": {
"type": "NumericLiteral",
"start": 48,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 48
},
"end": {
"line": 1,
"column": 49
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
}
},
{
"type": "ObjectProperty",
"start": 51,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 51
},
"end": {
"line": 1,
"column": 55
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 51,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 51
},
"end": {
"line": 1,
"column": 52
},
"identifierName": "b"
},
"name": "b"
},
"value": {
"type": "Identifier",
"start": 54,
"end": 55,
"loc": {
"start": {
"line": 1,
"column": 54
},
"end": {
"line": 1,
"column": 55
},
"identifierName": "s"
},
"name": "s"
}
},
{
"type": "ObjectProperty",
"start": 57,
"end": 65,
"loc": {
"start": {
"line": 1,
"column": 57
},
"end": {
"line": 1,
"column": 65
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 57,
"end": 58,
"loc": {
"start": {
"line": 1,
"column": 57
},
"end": {
"line": 1,
"column": 58
},
"identifierName": "c"
},
"name": "c"
},
"value": {
"type": "AssignmentPattern",
"start": 60,
"end": 65,
"loc": {
"start": {
"line": 1,
"column": 60
},
"end": {
"line": 1,
"column": 65
}
},
"left": {
"type": "Identifier",
"start": 60,
"end": 61,
"loc": {
"start": {
"line": 1,
"column": 60
},
"end": {
"line": 1,
"column": 61
},
"identifierName": "t"
},
"name": "t"
},
"right": {
"type": "NumericLiteral",
"start": 64,
"end": 65,
"loc": {
"start": {
"line": 1,
"column": 64
},
"end": {
"line": 1,
"column": 65
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
}
}
]
}
}
],
"body": {
"type": "BlockStatement",
"start": 68,
"end": 70,
"loc": {
"start": {
"line": 1,
"column": 68
},
"end": {
"line": 1,
"column": 70
}
},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
function multiElementWithLeading(x, y, ...{a: r, b: s, c: t}) {}

Some files were not shown because too many files have changed in this diff Show More