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:
committed by
Daniel Tschinder
parent
22741a8068
commit
14b7f50e51
205
test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-leading/expected.json
vendored
Normal file
205
test/fixtures/test262/rest-parameter/array-pattern-multi-element-with-leading/expected.json
vendored
Normal 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": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user