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
346
test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-initializer/expected.json
vendored
Normal file
346
test/fixtures/test262/rest-parameter/object-pattern-multi-element-with-initializer/expected.json
vendored
Normal 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": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user