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

881 lines
24 KiB
JSON

{
"type": "Script",
"span": {
"start": 64,
"end": 382,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 64,
"end": 105,
"ctxt": 0
},
"kind": "var",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 76,
"end": 104,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 76,
"end": 78,
"ctxt": 0
},
"value": "ab",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 78,
"end": 104,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 80,
"end": 104,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 82,
"end": 92,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 83,
"end": 91,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 85,
"end": 91,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 93,
"end": 102,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 93,
"end": 94,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 94,
"end": 102,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 96,
"end": 102,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 106,
"end": 149,
"ctxt": 0
},
"kind": "var",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 118,
"end": 148,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 118,
"end": 121,
"ctxt": 0
},
"value": "abq",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 121,
"end": 148,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 123,
"end": 148,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 125,
"end": 135,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 125,
"end": 126,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 126,
"end": 134,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 128,
"end": 134,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 136,
"end": 146,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 138,
"end": 146,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 140,
"end": 146,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 150,
"end": 179,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 154,
"end": 179,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 154,
"end": 161,
"ctxt": 0
},
"value": "unused1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 164,
"end": 179,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 166,
"end": 167,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 169,
"end": 170,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "SpreadElement",
"spread": {
"start": 172,
"end": 175,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 175,
"end": 177,
"ctxt": 0
},
"value": "ab",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 180,
"end": 210,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 184,
"end": 210,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 184,
"end": 191,
"ctxt": 0
},
"value": "unused2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 194,
"end": 210,
"ctxt": 0
},
"properties": [
{
"type": "SpreadElement",
"spread": {
"start": 196,
"end": 199,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 199,
"end": 201,
"ctxt": 0
},
"value": "ab",
"optional": false
}
},
{
"type": "SpreadElement",
"spread": {
"start": 203,
"end": 206,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 206,
"end": 208,
"ctxt": 0
},
"value": "ab",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 211,
"end": 241,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 215,
"end": 241,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 215,
"end": 222,
"ctxt": 0
},
"value": "unused3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 225,
"end": 241,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "SpreadElement",
"spread": {
"start": 233,
"end": 236,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 236,
"end": 239,
"ctxt": 0
},
"value": "abq",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 252,
"end": 253,
"ctxt": 0
},
"value": "g",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 254,
"end": 284,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 254,
"end": 284,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 257,
"end": 284,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 259,
"end": 284,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 261,
"end": 282,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 262,
"end": 282,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 264,
"end": 282,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 264,
"end": 270,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 273,
"end": 282,
"ctxt": 0
},
"kind": "undefined"
}
]
}
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 243,
"end": 318,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 286,
"end": 318,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 292,
"end": 316,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 299,
"end": 315,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 301,
"end": 302,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 304,
"end": 305,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "SpreadElement",
"spread": {
"start": 307,
"end": 310,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 310,
"end": 313,
"ctxt": 0
},
"value": "obj",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": "h",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 330,
"end": 348,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 330,
"end": 348,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 333,
"end": 348,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 335,
"end": 348,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 337,
"end": 346,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 337,
"end": 338,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 338,
"end": 346,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 340,
"end": 346,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 319,
"end": 382,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 350,
"end": 382,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 356,
"end": 380,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 363,
"end": 379,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 365,
"end": 366,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 368,
"end": 369,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "SpreadElement",
"spread": {
"start": 371,
"end": 374,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 374,
"end": 377,
"ctxt": 0
},
"value": "obj",
"optional": false
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}