swc/crates/swc_ecma_parser/tests/tsc/computedPropertyNames49_ES5.json

519 lines
16 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 2,
"end": 350,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 2,
"end": 350,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 6,
"end": 350,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 10,
"end": 350,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 16,
"end": 18,
"ctxt": 0
},
"value": "p1",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 20,
"end": 22,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
},
{
"type": "GetterProperty",
"span": {
"start": 28,
"end": 67,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 32,
"end": 39,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 33,
"end": 38,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "NumericLiteral",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 37,
"end": 38,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 42,
"end": 67,
"ctxt": 0
},
"stmts": [
{
"type": "ThrowStatement",
"span": {
"start": 52,
"end": 61,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 58,
"end": 60,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
]
}
},
{
"type": "GetterProperty",
"span": {
"start": 73,
"end": 113,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 77,
"end": 84,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 78,
"end": 83,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "NumericLiteral",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 87,
"end": 113,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 97,
"end": 107,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 104,
"end": 106,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
]
}
},
{
"type": "SetterProperty",
"span": {
"start": 119,
"end": 180,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 123,
"end": 130,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 124,
"end": 129,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "NumericLiteral",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
"param": {
"type": "Invalid",
"span": {
"start": 123,
"end": 130,
"ctxt": 0
}
},
"body": {
"type": "BlockStatement",
"span": {
"start": 133,
"end": 180,
"ctxt": 0
},
"stmts": [
{
"type": "ThrowStatement",
"span": {
"start": 165,
"end": 174,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 171,
"end": 173,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
]
}
},
{
"type": "GetterProperty",
"span": {
"start": 186,
"end": 258,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 190,
"end": 193,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 196,
"end": 258,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 206,
"end": 252,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 210,
"end": 216,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "NumericLiteral",
"span": {
"start": 210,
"end": 211,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 218,
"end": 252,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 232,
"end": 242,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 239,
"end": 241,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
]
},
"alternate": null
}
]
}
},
{
"type": "GetterProperty",
"span": {
"start": 264,
"end": 336,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 268,
"end": 271,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 274,
"end": 336,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 284,
"end": 330,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 288,
"end": 294,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "NumericLiteral",
"span": {
"start": 288,
"end": 289,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 293,
"end": 294,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 296,
"end": 330,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 310,
"end": 320,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 317,
"end": 319,
"ctxt": 0
},
"value": 20.0,
"raw": "20"
}
}
]
},
"alternate": null
}
]
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 342,
"end": 344,
"ctxt": 0
},
"value": "p2",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 346,
"end": 348,
"ctxt": 0
},
"value": 20.0,
"raw": "20"
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}