Brian Ng 14b7f50e51 Fix rest parameters with array and objects (#424)
* Fix rest parameters with array and objects

* Add test for array rest  with object

* reuse parseBindingIdentifier
2017-04-03 22:27:43 +02:00

154 lines
3.2 KiB
JSON

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