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

1463 lines
45 KiB
JSON

{
"type": "Script",
"span": {
"start": 20,
"end": 615,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 20,
"end": 32,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 24,
"end": 31,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 24,
"end": 26,
"ctxt": 0
},
"value": "ka",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 26,
"end": 31,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 28,
"end": 31,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 33,
"end": 52,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 37,
"end": 51,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 37,
"end": 43,
"ctxt": 0
},
"value": "nested",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 43,
"end": 51,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 45,
"end": 51,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 47,
"end": 49,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 47,
"end": 49,
"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": 53,
"end": 71,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 57,
"end": 70,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 57,
"end": 62,
"ctxt": 0
},
"value": "other",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 62,
"end": 70,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 64,
"end": 70,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 72,
"end": 86,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 76,
"end": 85,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 76,
"end": 80,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 80,
"end": 85,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 82,
"end": 85,
"ctxt": 0
},
"members": []
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 87,
"end": 129,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 91,
"end": 128,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 91,
"end": 98,
"ctxt": 0
},
"value": "complex",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 98,
"end": 128,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 100,
"end": 128,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 102,
"end": 116,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 102,
"end": 103,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 103,
"end": 115,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 105,
"end": 115,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 107,
"end": 110,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 107,
"end": 109,
"ctxt": 0
},
"value": "ka",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": null,
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 111,
"end": 113,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 111,
"end": 113,
"ctxt": 0
},
"value": "ki",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": null,
"typeParams": null
}
]
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 117,
"end": 126,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 117,
"end": 118,
"ctxt": 0
},
"value": "y",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 118,
"end": 126,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 120,
"end": 126,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 130,
"end": 184,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 130,
"end": 183,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 131,
"end": 182,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 131,
"end": 172,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "ObjectPattern",
"span": {
"start": 135,
"end": 152,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 137,
"end": 139,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 137,
"end": 139,
"ctxt": 0
},
"value": "ka",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 141,
"end": 150,
"ctxt": 0
},
"rest": {
"start": 141,
"end": 144,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"value": "nested",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 157,
"end": 162,
"ctxt": 0
},
"value": "other",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "RestElement",
"span": {
"start": 164,
"end": 171,
"ctxt": 0
},
"rest": {
"start": 164,
"end": 167,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 167,
"end": 171,
"ctxt": 0
},
"value": "rest",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 175,
"end": 182,
"ctxt": 0
},
"value": "complex",
"optional": false
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 200,
"end": 315,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 204,
"end": 314,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 204,
"end": 212,
"ctxt": 0
},
"value": "overEmit",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 212,
"end": 314,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 214,
"end": 314,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 216,
"end": 247,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 217,
"end": 246,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 219,
"end": 246,
"ctxt": 0
},
"elemType": {
"type": "TsTypeLiteral",
"span": {
"start": 219,
"end": 244,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 221,
"end": 232,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 221,
"end": 223,
"ctxt": 0
},
"value": "ka",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 223,
"end": 231,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 225,
"end": 231,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 233,
"end": 242,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 233,
"end": 234,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 234,
"end": 242,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 236,
"end": 242,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 248,
"end": 289,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 248,
"end": 249,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 249,
"end": 288,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 251,
"end": 288,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 253,
"end": 263,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 253,
"end": 254,
"ctxt": 0
},
"value": "z",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 254,
"end": 262,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 256,
"end": 262,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 264,
"end": 275,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 264,
"end": 266,
"ctxt": 0
},
"value": "ki",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 266,
"end": 274,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 268,
"end": 274,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 276,
"end": 286,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 276,
"end": 278,
"ctxt": 0
},
"value": "ku",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 278,
"end": 286,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 280,
"end": 286,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 290,
"end": 301,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 290,
"end": 292,
"ctxt": 0
},
"value": "ke",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 292,
"end": 300,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 294,
"end": 300,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 302,
"end": 312,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 302,
"end": 304,
"ctxt": 0
},
"value": "ko",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 304,
"end": 312,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 306,
"end": 312,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 474,
"end": 545,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 478,
"end": 544,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 478,
"end": 533,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 480,
"end": 481,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "ArrayPattern",
"span": {
"start": 483,
"end": 505,
"ctxt": 0
},
"elements": [
{
"type": "ObjectPattern",
"span": {
"start": 484,
"end": 498,
"ctxt": 0
},
"properties": [
{
"type": "RestElement",
"span": {
"start": 486,
"end": 496,
"ctxt": 0
},
"rest": {
"start": 486,
"end": 489,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 489,
"end": 496,
"ctxt": 0
},
"value": "nested2",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
{
"type": "RestElement",
"span": {
"start": 500,
"end": 504,
"ctxt": 0
},
"rest": {
"start": 500,
"end": 503,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 503,
"end": 504,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 507,
"end": 508,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ObjectPattern",
"span": {
"start": 510,
"end": 521,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 512,
"end": 513,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 512,
"end": 513,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 515,
"end": 519,
"ctxt": 0
},
"rest": {
"start": 515,
"end": 518,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 518,
"end": 519,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "RestElement",
"span": {
"start": 523,
"end": 531,
"ctxt": 0
},
"rest": {
"start": 523,
"end": 526,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 526,
"end": 531,
"ctxt": 0
},
"value": "rest2",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "Identifier",
"span": {
"start": 536,
"end": 544,
"ctxt": 0
},
"value": "overEmit",
"optional": false
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 546,
"end": 615,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 546,
"end": 614,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 547,
"end": 613,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 547,
"end": 602,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 549,
"end": 550,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": {
"type": "ArrayPattern",
"span": {
"start": 552,
"end": 574,
"ctxt": 0
},
"elements": [
{
"type": "ObjectPattern",
"span": {
"start": 553,
"end": 567,
"ctxt": 0
},
"properties": [
{
"type": "RestElement",
"span": {
"start": 555,
"end": 565,
"ctxt": 0
},
"rest": {
"start": 555,
"end": 558,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 558,
"end": 565,
"ctxt": 0
},
"value": "nested2",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
{
"type": "RestElement",
"span": {
"start": 572,
"end": 573,
"ctxt": 0
},
"rest": {
"start": 569,
"end": 572,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 572,
"end": 573,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 576,
"end": 577,
"ctxt": 0
},
"value": "b",
"optional": false
},
"value": {
"type": "ObjectPattern",
"span": {
"start": 579,
"end": 590,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 581,
"end": 582,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 581,
"end": 582,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": null
},
{
"type": "RestElement",
"span": {
"start": 584,
"end": 588,
"ctxt": 0
},
"rest": {
"start": 584,
"end": 587,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 587,
"end": 588,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
},
{
"type": "RestElement",
"span": {
"start": 592,
"end": 600,
"ctxt": 0
},
"rest": {
"start": 592,
"end": 595,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 595,
"end": 600,
"ctxt": 0
},
"value": "rest2",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 605,
"end": 613,
"ctxt": 0
},
"value": "overEmit",
"optional": false
}
}
}
}
],
"interpreter": null
}