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

1011 lines
27 KiB
JSON

{
"type": "Script",
"span": {
"start": 17,
"end": 540,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 17,
"end": 75,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 29,
"end": 74,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 29,
"end": 37,
"ctxt": 0
},
"value": "indexed1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 37,
"end": 74,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 39,
"end": 74,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 42,
"end": 51,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 43,
"end": 51,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 45,
"end": 51,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 52,
"end": 60,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 54,
"end": 60,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": false,
"static": false,
"span": {
"start": 41,
"end": 61,
"ctxt": 0
}
},
{
"type": "TsPropertySignature",
"span": {
"start": 62,
"end": 72,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 62,
"end": 63,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 63,
"end": 71,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 65,
"end": 71,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 76,
"end": 136,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 88,
"end": 135,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 88,
"end": 96,
"ctxt": 0
},
"value": "indexed2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 96,
"end": 135,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 98,
"end": 135,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 101,
"end": 110,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 102,
"end": 110,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 104,
"end": 110,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 111,
"end": 120,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 113,
"end": 120,
"ctxt": 0
},
"kind": "boolean"
}
},
"readonly": false,
"static": false,
"span": {
"start": 100,
"end": 121,
"ctxt": 0
}
},
{
"type": "TsPropertySignature",
"span": {
"start": 122,
"end": 133,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 123,
"end": 132,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 125,
"end": 132,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 137,
"end": 183,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 149,
"end": 182,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 149,
"end": 157,
"ctxt": 0
},
"value": "indexed3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 157,
"end": 182,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 159,
"end": 182,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 162,
"end": 171,
"ctxt": 0
},
"value": "n",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 163,
"end": 171,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 165,
"end": 171,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 172,
"end": 180,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 174,
"end": 180,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": false,
"static": false,
"span": {
"start": 161,
"end": 180,
"ctxt": 0
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 184,
"end": 215,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 188,
"end": 214,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 192,
"end": 214,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 194,
"end": 197,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 197,
"end": 205,
"ctxt": 0
},
"value": "indexed1",
"optional": false
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 207,
"end": 208,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 210,
"end": 212,
"ctxt": 0
},
"value": 11.0
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 260,
"end": 267,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 260,
"end": 266,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 260,
"end": 261,
"ctxt": 0
},
"value": "i",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 261,
"end": 266,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 262,
"end": 265,
"ctxt": 0
},
"value": 101.0
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 268,
"end": 306,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 272,
"end": 305,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 272,
"end": 274,
"ctxt": 0
},
"value": "ii",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 277,
"end": 305,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 279,
"end": 282,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 282,
"end": 290,
"ctxt": 0
},
"value": "indexed1",
"optional": false
}
},
{
"type": "SpreadElement",
"spread": {
"start": 292,
"end": 295,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 295,
"end": 303,
"ctxt": 0
},
"value": "indexed2",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 358,
"end": 367,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 358,
"end": 366,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 358,
"end": 360,
"ctxt": 0
},
"value": "ii",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 360,
"end": 366,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 361,
"end": 365,
"ctxt": 0
},
"value": 1001.0
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 369,
"end": 394,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 383,
"end": 393,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 383,
"end": 384,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 384,
"end": 393,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 386,
"end": 393,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 395,
"end": 438,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 395,
"end": 437,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 395,
"end": 403,
"ctxt": 0
},
"value": "indexed3",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 406,
"end": 437,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 408,
"end": 411,
"ctxt": 0
},
"arguments": {
"type": "ConditionalExpression",
"span": {
"start": 411,
"end": 435,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 411,
"end": 412,
"ctxt": 0
},
"value": "b",
"optional": false
},
"consequent": {
"type": "Identifier",
"span": {
"start": 415,
"end": 423,
"ctxt": 0
},
"value": "indexed3",
"optional": false
},
"alternate": {
"type": "Identifier",
"span": {
"start": 426,
"end": 435,
"ctxt": 0
},
"value": "undefined",
"optional": false
}
}
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 440,
"end": 493,
"ctxt": 0
},
"kind": "var",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 452,
"end": 492,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 452,
"end": 459,
"ctxt": 0
},
"value": "roindex",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 459,
"end": 492,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 461,
"end": 492,
"ctxt": 0
},
"members": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 473,
"end": 481,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 474,
"end": 481,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 475,
"end": 481,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 482,
"end": 490,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 484,
"end": 490,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": true,
"static": false,
"span": {
"start": 463,
"end": 490,
"ctxt": 0
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 494,
"end": 524,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 498,
"end": 523,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 498,
"end": 506,
"ctxt": 0
},
"value": "writable",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 509,
"end": 523,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 511,
"end": 514,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 514,
"end": 521,
"ctxt": 0
},
"value": "roindex",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 525,
"end": 540,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 525,
"end": 539,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 525,
"end": 535,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 525,
"end": 533,
"ctxt": 0
},
"value": "writable",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 534,
"end": 535,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 538,
"end": 539,
"ctxt": 0
},
"value": 0.0
}
}
}
],
"interpreter": null
}