* refactor: avoid duplicate property access * refactor: tweak parseMember * polish: recover from shorthand assign in exprs
102 lines
4.1 KiB
JSON
102 lines
4.1 KiB
JSON
{
|
|
"type": "File",
|
|
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}},
|
|
"errors": [
|
|
"SyntaxError: Invalid shorthand property initializer. (2:6)"
|
|
],
|
|
"program": {
|
|
"type": "Program",
|
|
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}},
|
|
"sourceType": "script",
|
|
"interpreter": null,
|
|
"body": [
|
|
{
|
|
"type": "VariableDeclaration",
|
|
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start":6,"end":43,"loc":{"start":{"line":1,"column":6},"end":{"line":4,"column":1}},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"obj"},
|
|
"name": "obj"
|
|
},
|
|
"init": {
|
|
"type": "ObjectExpression",
|
|
"start":12,"end":43,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}},
|
|
"properties": [
|
|
{
|
|
"type": "ObjectProperty",
|
|
"start":16,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}},
|
|
"method": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start":16,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"},
|
|
"name": "foo"
|
|
},
|
|
"computed": false,
|
|
"shorthand": true,
|
|
"value": {
|
|
"type": "AssignmentPattern",
|
|
"start":16,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}},
|
|
"left": {
|
|
"type": "Identifier",
|
|
"start":16,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"},
|
|
"name": "foo"
|
|
},
|
|
"right": {
|
|
"type": "NumericLiteral",
|
|
"start":22,"end":25,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}},
|
|
"extra": {
|
|
"rawValue": 123,
|
|
"raw": "123"
|
|
},
|
|
"value": 123
|
|
}
|
|
},
|
|
"extra": {
|
|
"shorthand": true
|
|
}
|
|
},
|
|
{
|
|
"type": "ObjectProperty",
|
|
"start":29,"end":41,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}},
|
|
"method": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start":29,"end":32,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5},"identifierName":"bar"},
|
|
"name": "bar"
|
|
},
|
|
"computed": false,
|
|
"shorthand": false,
|
|
"value": {
|
|
"type": "AssignmentExpression",
|
|
"start":34,"end":41,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":14}},
|
|
"operator": "=",
|
|
"left": {
|
|
"type": "Identifier",
|
|
"start":34,"end":35,"loc":{"start":{"line":3,"column":7},"end":{"line":3,"column":8},"identifierName":"x"},
|
|
"name": "x"
|
|
},
|
|
"right": {
|
|
"type": "NumericLiteral",
|
|
"start":38,"end":41,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":14}},
|
|
"extra": {
|
|
"rawValue": 123,
|
|
"raw": "123"
|
|
},
|
|
"value": 123
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"kind": "const"
|
|
}
|
|
],
|
|
"directives": []
|
|
}
|
|
} |