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

1015 lines
27 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 541,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 18,
"end": 76,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 30,
"end": 75,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 30,
"end": 38,
"ctxt": 0
},
"value": "indexed1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 38,
"end": 75,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 40,
"end": 75,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 43,
"end": 52,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 44,
"end": 52,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 46,
"end": 52,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 53,
"end": 61,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 55,
"end": 61,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": false,
"static": false,
"span": {
"start": 42,
"end": 62,
"ctxt": 0
}
},
{
"type": "TsPropertySignature",
"span": {
"start": 63,
"end": 73,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 63,
"end": 64,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 64,
"end": 72,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 66,
"end": 72,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 77,
"end": 137,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 89,
"end": 136,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 89,
"end": 97,
"ctxt": 0
},
"value": "indexed2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 97,
"end": 136,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 99,
"end": 136,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 102,
"end": 111,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 103,
"end": 111,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 105,
"end": 111,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 112,
"end": 121,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 114,
"end": 121,
"ctxt": 0
},
"kind": "boolean"
}
},
"readonly": false,
"static": false,
"span": {
"start": 101,
"end": 122,
"ctxt": 0
}
},
{
"type": "TsPropertySignature",
"span": {
"start": 123,
"end": 134,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 124,
"end": 133,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 126,
"end": 133,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 138,
"end": 184,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 150,
"end": 183,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 150,
"end": 158,
"ctxt": 0
},
"value": "indexed3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 158,
"end": 183,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 160,
"end": 183,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 163,
"end": 172,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 164,
"end": 172,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 166,
"end": 172,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 173,
"end": 181,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 175,
"end": 181,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": false,
"static": false,
"span": {
"start": 162,
"end": 181,
"ctxt": 0
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 185,
"end": 216,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 189,
"end": 215,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 193,
"end": 215,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 195,
"end": 198,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 198,
"end": 206,
"ctxt": 0
},
"value": "indexed1",
"optional": false
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 208,
"end": 209,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 211,
"end": 213,
"ctxt": 0
},
"value": 11.0,
"raw": "11"
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 261,
"end": 268,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 261,
"end": 267,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"value": "i",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 262,
"end": 267,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 263,
"end": 266,
"ctxt": 0
},
"value": 101.0,
"raw": "101"
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 269,
"end": 307,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 273,
"end": 306,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 273,
"end": 275,
"ctxt": 0
},
"value": "ii",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 278,
"end": 306,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 280,
"end": 283,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 283,
"end": 291,
"ctxt": 0
},
"value": "indexed1",
"optional": false
}
},
{
"type": "SpreadElement",
"spread": {
"start": 293,
"end": 296,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 296,
"end": 304,
"ctxt": 0
},
"value": "indexed2",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 359,
"end": 368,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 359,
"end": 367,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 359,
"end": 361,
"ctxt": 0
},
"value": "ii",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 361,
"end": 367,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 362,
"end": 366,
"ctxt": 0
},
"value": 1001.0,
"raw": "1001"
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 370,
"end": 395,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 384,
"end": 394,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 384,
"end": 385,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 385,
"end": 394,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 387,
"end": 394,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 396,
"end": 439,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 396,
"end": 438,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 396,
"end": 404,
"ctxt": 0
},
"value": "indexed3",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 407,
"end": 438,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 409,
"end": 412,
"ctxt": 0
},
"arguments": {
"type": "ConditionalExpression",
"span": {
"start": 412,
"end": 436,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 412,
"end": 413,
"ctxt": 0
},
"value": "b",
"optional": false
},
"consequent": {
"type": "Identifier",
"span": {
"start": 416,
"end": 424,
"ctxt": 0
},
"value": "indexed3",
"optional": false
},
"alternate": {
"type": "Identifier",
"span": {
"start": 427,
"end": 436,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 441,
"end": 494,
"ctxt": 0
},
"kind": "var",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 453,
"end": 493,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 453,
"end": 460,
"ctxt": 0
},
"value": "roindex",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 460,
"end": 493,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 462,
"end": 493,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 474,
"end": 482,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 475,
"end": 482,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 476,
"end": 482,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 483,
"end": 491,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 485,
"end": 491,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": true,
"static": false,
"span": {
"start": 464,
"end": 491,
"ctxt": 0
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 495,
"end": 525,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 499,
"end": 524,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 499,
"end": 507,
"ctxt": 0
},
"value": "writable",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 510,
"end": 524,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 512,
"end": 515,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 515,
"end": 522,
"ctxt": 0
},
"value": "roindex",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 526,
"end": 541,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 526,
"end": 540,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 526,
"end": 536,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 526,
"end": 534,
"ctxt": 0
},
"value": "writable",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 535,
"end": 536,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 539,
"end": 540,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
}
],
"interpreter": null
}