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

1463 lines
45 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 19,
"end": 614,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 19,
"end": 31,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 23,
"end": 30,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 23,
"end": 25,
"ctxt": 0
},
"value": "ka",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 25,
"end": 30,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 27,
"end": 30,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 32,
"end": 51,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 36,
"end": 50,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 36,
"end": 42,
"ctxt": 0
},
"value": "nested",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 42,
"end": 50,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 44,
"end": 50,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 46,
"end": 48,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 46,
"end": 48,
"ctxt": 0
},
"value": "ki",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": null,
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 52,
"end": 70,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 56,
"end": 69,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 61,
"ctxt": 0
},
"value": "other",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 61,
"end": 69,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 63,
"end": 69,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 71,
"end": 85,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 75,
"end": 84,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 75,
"end": 79,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 79,
"end": 84,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 81,
"end": 84,
"ctxt": 0
},
"members": []
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 86,
"end": 128,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 90,
"end": 127,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 90,
"end": 97,
"ctxt": 0
},
"value": "complex",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 97,
"end": 127,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 99,
"end": 127,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 101,
"end": 115,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 102,
"end": 114,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 104,
"end": 114,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 106,
"end": 109,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 106,
"end": 108,
"ctxt": 0
},
"value": "ka",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": null,
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 110,
"end": 112,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 110,
"end": 112,
"ctxt": 0
},
"value": "ki",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": null,
"typeParams": null
}
]
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 116,
"end": 125,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 116,
"end": 117,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 117,
"end": 125,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 119,
"end": 125,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 129,
"end": 183,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 129,
"end": 182,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 130,
"end": 181,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 130,
"end": 171,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "ObjectPattern",
"span": {
"start": 134,
"end": 151,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 136,
"end": 138,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 136,
"end": 138,
"ctxt": 0
},
"value": "ka",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 140,
"end": 149,
"ctxt": 0
},
"rest": {
"start": 140,
"end": 143,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 143,
"end": 149,
"ctxt": 0
},
"value": "nested",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 156,
"end": 161,
"ctxt": 0
},
"value": "other",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "RestElement",
"span": {
"start": 163,
"end": 170,
"ctxt": 0
},
"rest": {
"start": 163,
"end": 166,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 166,
"end": 170,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 174,
"end": 181,
"ctxt": 0
},
"value": "complex",
"optional": false
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 199,
"end": 314,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 203,
"end": 313,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 203,
"end": 211,
"ctxt": 0
},
"value": "overEmit",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 211,
"end": 313,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 213,
"end": 313,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 215,
"end": 246,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 216,
"end": 245,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 218,
"end": 245,
"ctxt": 0
},
"elemType": {
"type": "TsTypeLiteral",
"span": {
"start": 218,
"end": 243,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 220,
"end": 231,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 220,
"end": 222,
"ctxt": 0
},
"value": "ka",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 222,
"end": 230,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 224,
"end": 230,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 232,
"end": 241,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 233,
"end": 241,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 235,
"end": 241,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 247,
"end": 288,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 247,
"end": 248,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 248,
"end": 287,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 250,
"end": 287,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 252,
"end": 262,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 252,
"end": 253,
"ctxt": 0
},
"value": "z",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 253,
"end": 261,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 255,
"end": 261,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 263,
"end": 274,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 263,
"end": 265,
"ctxt": 0
},
"value": "ki",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 265,
"end": 273,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 267,
"end": 273,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 275,
"end": 285,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 275,
"end": 277,
"ctxt": 0
},
"value": "ku",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 277,
"end": 285,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 279,
"end": 285,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 289,
"end": 300,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 289,
"end": 291,
"ctxt": 0
},
"value": "ke",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 291,
"end": 299,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 293,
"end": 299,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 301,
"end": 311,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 301,
"end": 303,
"ctxt": 0
},
"value": "ko",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 303,
"end": 311,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 305,
"end": 311,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 473,
"end": 544,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 477,
"end": 543,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 477,
"end": 532,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 479,
"end": 480,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "ArrayPattern",
"span": {
"start": 482,
"end": 504,
"ctxt": 0
},
"elements": [
{
"type": "ObjectPattern",
"span": {
"start": 483,
"end": 497,
"ctxt": 0
},
"properties": [
{
"type": "RestElement",
"span": {
"start": 485,
"end": 495,
"ctxt": 0
},
"rest": {
"start": 485,
"end": 488,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 488,
"end": 495,
"ctxt": 0
},
"value": "nested2",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
{
"type": "RestElement",
"span": {
"start": 499,
"end": 503,
"ctxt": 0
},
"rest": {
"start": 499,
"end": 502,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 502,
"end": 503,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 506,
"end": 507,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ObjectPattern",
"span": {
"start": 509,
"end": 520,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 511,
"end": 512,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 511,
"end": 512,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 514,
"end": 518,
"ctxt": 0
},
"rest": {
"start": 514,
"end": 517,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 517,
"end": 518,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "RestElement",
"span": {
"start": 522,
"end": 530,
"ctxt": 0
},
"rest": {
"start": 522,
"end": 525,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 525,
"end": 530,
"ctxt": 0
},
"value": "rest2",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "Identifier",
"span": {
"start": 535,
"end": 543,
"ctxt": 0
},
"value": "overEmit",
"optional": false
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 545,
"end": 614,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 545,
"end": 613,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 546,
"end": 612,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 546,
"end": 601,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 548,
"end": 549,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "ArrayPattern",
"span": {
"start": 551,
"end": 573,
"ctxt": 0
},
"elements": [
{
"type": "ObjectPattern",
"span": {
"start": 552,
"end": 566,
"ctxt": 0
},
"properties": [
{
"type": "RestElement",
"span": {
"start": 554,
"end": 564,
"ctxt": 0
},
"rest": {
"start": 554,
"end": 557,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 557,
"end": 564,
"ctxt": 0
},
"value": "nested2",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
{
"type": "RestElement",
"span": {
"start": 571,
"end": 572,
"ctxt": 0
},
"rest": {
"start": 568,
"end": 571,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 571,
"end": 572,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 575,
"end": 576,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ObjectPattern",
"span": {
"start": 578,
"end": 589,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 580,
"end": 581,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 580,
"end": 581,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 583,
"end": 587,
"ctxt": 0
},
"rest": {
"start": 583,
"end": 586,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 586,
"end": 587,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "RestElement",
"span": {
"start": 591,
"end": 599,
"ctxt": 0
},
"rest": {
"start": 591,
"end": 594,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 594,
"end": 599,
"ctxt": 0
},
"value": "rest2",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 604,
"end": 612,
"ctxt": 0
},
"value": "overEmit",
"optional": false
}
}
}
}
],
"interpreter": null
}