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

870 lines
25 KiB
JSON

{
"type": "Script",
"span": {
"start": 17,
"end": 386,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 17,
"end": 31,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 21,
"end": 30,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"value": "s",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 22,
"end": 30,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 24,
"end": 30,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 32,
"end": 46,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 36,
"end": 45,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 36,
"end": 37,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 37,
"end": 45,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 39,
"end": 45,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 47,
"end": 58,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 51,
"end": 57,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 52,
"end": 57,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 54,
"end": 57,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 59,
"end": 386,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 63,
"end": 386,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 63,
"end": 64,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 67,
"end": 386,
"ctxt": 0
},
"properties": [
{
"type": "GetterProperty",
"span": {
"start": 73,
"end": 96,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 77,
"end": 80,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"value": "s",
"optional": false
}
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 83,
"end": 96,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 85,
"end": 94,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 92,
"end": 93,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
]
}
},
{
"type": "SetterProperty",
"span": {
"start": 102,
"end": 116,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 106,
"end": 109,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 107,
"end": 108,
"ctxt": 0
},
"value": "n",
"optional": false
}
},
"param": {
"type": "Identifier",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 113,
"end": 116,
"ctxt": 0
},
"stmts": []
}
},
{
"type": "GetterProperty",
"span": {
"start": 122,
"end": 149,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 126,
"end": 133,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 127,
"end": 132,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "s",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 136,
"end": 149,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 138,
"end": 147,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 145,
"end": 146,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
]
}
},
{
"type": "SetterProperty",
"span": {
"start": 155,
"end": 173,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 159,
"end": 166,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 160,
"end": 165,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"value": "s",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"value": "n",
"optional": false
}
}
},
"param": {
"type": "Identifier",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 170,
"end": 173,
"ctxt": 0
},
"stmts": []
}
},
{
"type": "GetterProperty",
"span": {
"start": 179,
"end": 203,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 183,
"end": 187,
"ctxt": 0
},
"expression": {
"type": "UnaryExpression",
"span": {
"start": 184,
"end": 186,
"ctxt": 0
},
"operator": "+",
"argument": {
"type": "Identifier",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "s",
"optional": false
}
}
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 190,
"end": 203,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 192,
"end": 201,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 199,
"end": 200,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
]
}
},
{
"type": "SetterProperty",
"span": {
"start": 209,
"end": 224,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 213,
"end": 217,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 214,
"end": 216,
"ctxt": 0
},
"value": "",
"raw": "\"\""
}
},
"param": {
"type": "Identifier",
"span": {
"start": 218,
"end": 219,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 221,
"end": 224,
"ctxt": 0
},
"stmts": []
}
},
{
"type": "GetterProperty",
"span": {
"start": 230,
"end": 253,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 234,
"end": 237,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 235,
"end": 236,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 240,
"end": 253,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 242,
"end": 251,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
]
}
},
{
"type": "SetterProperty",
"span": {
"start": 259,
"end": 273,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 263,
"end": 266,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"param": {
"type": "Identifier",
"span": {
"start": 267,
"end": 268,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 270,
"end": 273,
"ctxt": 0
},
"stmts": []
}
},
{
"type": "GetterProperty",
"span": {
"start": 279,
"end": 310,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 283,
"end": 294,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 284,
"end": 293,
"ctxt": 0
},
"expression": {
"type": "BooleanLiteral",
"span": {
"start": 289,
"end": 293,
"ctxt": 0
},
"value": true
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 285,
"end": 288,
"ctxt": 0
},
"kind": "any"
}
}
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 297,
"end": 310,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 299,
"end": 308,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 306,
"end": 307,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
]
}
},
{
"type": "SetterProperty",
"span": {
"start": 316,
"end": 340,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 320,
"end": 333,
"ctxt": 0
},
"expression": {
"type": "TemplateLiteral",
"span": {
"start": 321,
"end": 332,
"ctxt": 0
},
"expressions": [],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 322,
"end": 331,
"ctxt": 0
},
"tail": true,
"cooked": "hello bye",
"raw": "hello bye"
}
]
}
},
"param": {
"type": "Identifier",
"span": {
"start": 334,
"end": 335,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": null
},
"body": {
"type": "BlockStatement",
"span": {
"start": 337,
"end": 340,
"ctxt": 0
},
"stmts": []
}
},
{
"type": "GetterProperty",
"span": {
"start": 346,
"end": 384,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 350,
"end": 368,
"ctxt": 0
},
"expression": {
"type": "TemplateLiteral",
"span": {
"start": 351,
"end": 367,
"ctxt": 0
},
"expressions": [
{
"type": "Identifier",
"span": {
"start": 360,
"end": 361,
"ctxt": 0
},
"value": "a",
"optional": false
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 352,
"end": 358,
"ctxt": 0
},
"tail": false,
"cooked": "hello ",
"raw": "hello "
},
{
"type": "TemplateElement",
"span": {
"start": 362,
"end": 366,
"ctxt": 0
},
"tail": true,
"cooked": " bye",
"raw": " bye"
}
]
}
},
"typeAnnotation": null,
"body": {
"type": "BlockStatement",
"span": {
"start": 371,
"end": 384,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 373,
"end": 382,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 380,
"end": 381,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
]
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}