swc/crates/swc_ecma_parser/tests/tsc/callChain.3.json

1227 lines
35 KiB
JSON

{
"type": "Script",
"span": {
"start": 18,
"end": 492,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 35,
"end": 41,
"ctxt": 0
},
"value": "absorb",
"optional": false
},
"declare": true,
"params": [],
"decorators": [],
"span": {
"start": 18,
"end": 50,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 41,
"end": 44,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 46,
"end": 49,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 48,
"end": 49,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 48,
"end": 49,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 51,
"end": 106,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 65,
"end": 105,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 66,
"end": 105,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 68,
"end": 105,
"ctxt": 0
},
"types": [
{
"type": "TsTypeLiteral",
"span": {
"start": 68,
"end": 93,
"ctxt": 0
},
"members": [
{
"type": "TsMethodSignature",
"span": {
"start": 70,
"end": 91,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "m",
"optional": false
},
"computed": false,
"optional": true,
"params": [
{
"type": "Identifier",
"span": {
"start": 76,
"end": 87,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 79,
"end": 87,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 81,
"end": 87,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 82,
"end": 86,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 83,
"end": 86,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 88,
"end": 91,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 72,
"end": 75,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 73,
"end": 74,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
}
}
]
},
{
"type": "TsKeywordType",
"span": {
"start": 96,
"end": 105,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 107,
"end": 143,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 113,
"end": 142,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 113,
"end": 115,
"ctxt": 0
},
"value": "n1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 115,
"end": 123,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 117,
"end": 123,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "OptionalChainingExpression",
"span": {
"start": 126,
"end": 142,
"ctxt": 0
},
"questionDotToken": {
"start": 130,
"end": 131,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 126,
"end": 142,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 126,
"end": 130,
"ctxt": 0
},
"questionDotToken": {
"start": 127,
"end": 128,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 126,
"end": 130,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 133,
"end": 141,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 134,
"end": 135,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 137,
"end": 139,
"ctxt": 0
},
"value": 12.0
}
}
]
}
}
],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 210,
"end": 251,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 216,
"end": 250,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 216,
"end": 218,
"ctxt": 0
},
"value": "n2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 218,
"end": 226,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 220,
"end": 226,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "OptionalChainingExpression",
"span": {
"start": 229,
"end": 250,
"ctxt": 0
},
"questionDotToken": {
"start": 233,
"end": 234,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 229,
"end": 250,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 229,
"end": 233,
"ctxt": 0
},
"questionDotToken": {
"start": 230,
"end": 231,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 229,
"end": 233,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 229,
"end": 230,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 236,
"end": 249,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 237,
"end": 238,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "CallExpression",
"span": {
"start": 240,
"end": 248,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 240,
"end": 246,
"ctxt": 0
},
"value": "absorb",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
]
}
}
],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 264,
"end": 311,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 270,
"end": 310,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 270,
"end": 272,
"ctxt": 0
},
"value": "n3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 272,
"end": 292,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 274,
"end": 292,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 274,
"end": 280,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 283,
"end": 292,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": {
"type": "OptionalChainingExpression",
"span": {
"start": 295,
"end": 310,
"ctxt": 0
},
"questionDotToken": {
"start": 299,
"end": 300,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 295,
"end": 310,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 295,
"end": 299,
"ctxt": 0
},
"questionDotToken": {
"start": 296,
"end": 297,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 295,
"end": 299,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 295,
"end": 296,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 298,
"end": 299,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 302,
"end": 309,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 303,
"end": 304,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 306,
"end": 308,
"ctxt": 0
},
"value": 12.0
}
}
]
}
}
],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 328,
"end": 381,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 334,
"end": 380,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 334,
"end": 336,
"ctxt": 0
},
"value": "n4",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 336,
"end": 356,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 338,
"end": 356,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 338,
"end": 344,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 347,
"end": 356,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": {
"type": "OptionalChainingExpression",
"span": {
"start": 359,
"end": 380,
"ctxt": 0
},
"questionDotToken": {
"start": 363,
"end": 364,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 359,
"end": 380,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 359,
"end": 363,
"ctxt": 0
},
"questionDotToken": {
"start": 360,
"end": 361,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 359,
"end": 363,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 359,
"end": 360,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 362,
"end": 363,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 366,
"end": 379,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 367,
"end": 368,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "CallExpression",
"span": {
"start": 370,
"end": 378,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 370,
"end": 376,
"ctxt": 0
},
"value": "absorb",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
]
}
}
],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 446,
"end": 471,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 450,
"end": 470,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 450,
"end": 452,
"ctxt": 0
},
"value": "t1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "OptionalChainingExpression",
"span": {
"start": 455,
"end": 470,
"ctxt": 0
},
"questionDotToken": {
"start": 459,
"end": 460,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 455,
"end": 470,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 455,
"end": 459,
"ctxt": 0
},
"questionDotToken": {
"start": 456,
"end": 457,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 455,
"end": 459,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 455,
"end": 456,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 458,
"end": 459,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 462,
"end": 469,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 463,
"end": 464,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 466,
"end": 468,
"ctxt": 0
},
"value": 12.0
}
}
]
}
}
],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 472,
"end": 492,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 472,
"end": 491,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 472,
"end": 474,
"ctxt": 0
},
"value": "t1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 477,
"end": 491,
"ctxt": 0
},
"callee": {
"type": "TsNonNullExpression",
"span": {
"start": 477,
"end": 482,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 477,
"end": 481,
"ctxt": 0
},
"object": {
"type": "TsNonNullExpression",
"span": {
"start": 477,
"end": 479,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 477,
"end": 478,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 480,
"end": 481,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 483,
"end": 490,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 484,
"end": 485,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 487,
"end": 489,
"ctxt": 0
},
"value": 12.0
}
}
]
}
}
],
"typeArguments": null
}
}
}
],
"interpreter": null
}