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

1231 lines
36 KiB
JSON

{
"type": "Script",
"span": {
"start": 19,
"end": 493,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 36,
"end": 42,
"ctxt": 0
},
"value": "absorb",
"optional": false
},
"declare": true,
"params": [],
"decorators": [],
"span": {
"start": 19,
"end": 51,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 42,
"end": 45,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 43,
"end": 44,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 43,
"end": 44,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 47,
"end": 50,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 49,
"end": 50,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 49,
"end": 50,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 52,
"end": 107,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 66,
"end": 106,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 66,
"end": 67,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 67,
"end": 106,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 69,
"end": 106,
"ctxt": 0
},
"types": [
{
"type": "TsTypeLiteral",
"span": {
"start": 69,
"end": 94,
"ctxt": 0
},
"members": [
{
"type": "TsMethodSignature",
"span": {
"start": 71,
"end": 92,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "m",
"optional": false
},
"computed": false,
"optional": true,
"params": [
{
"type": "Identifier",
"span": {
"start": 77,
"end": 88,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 80,
"end": 88,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 82,
"end": 88,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 83,
"end": 87,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 83,
"end": 84,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 84,
"end": 87,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 86,
"end": 87,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 86,
"end": 87,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": null
}
]
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 89,
"end": 92,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 91,
"end": 92,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 73,
"end": 76,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
}
}
]
},
{
"type": "TsKeywordType",
"span": {
"start": 97,
"end": 106,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 108,
"end": 144,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 114,
"end": 143,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 114,
"end": 116,
"ctxt": 0
},
"value": "n1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 116,
"end": 124,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 118,
"end": 124,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "OptionalChainingExpression",
"span": {
"start": 127,
"end": 143,
"ctxt": 0
},
"questionDotToken": {
"start": 131,
"end": 132,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 127,
"end": 143,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 127,
"end": 131,
"ctxt": 0
},
"questionDotToken": {
"start": 128,
"end": 129,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 127,
"end": 131,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 127,
"end": 128,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 134,
"end": 142,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 135,
"end": 136,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 138,
"end": 140,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
]
}
}
],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 211,
"end": 252,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 217,
"end": 251,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 217,
"end": 219,
"ctxt": 0
},
"value": "n2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 219,
"end": 227,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 221,
"end": 227,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "OptionalChainingExpression",
"span": {
"start": 230,
"end": 251,
"ctxt": 0
},
"questionDotToken": {
"start": 234,
"end": 235,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 230,
"end": 251,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 230,
"end": 234,
"ctxt": 0
},
"questionDotToken": {
"start": 231,
"end": 232,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 230,
"end": 234,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 233,
"end": 234,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 237,
"end": 250,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 238,
"end": 239,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "CallExpression",
"span": {
"start": 241,
"end": 249,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 241,
"end": 247,
"ctxt": 0
},
"value": "absorb",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
]
}
}
],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 265,
"end": 312,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 271,
"end": 311,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 271,
"end": 273,
"ctxt": 0
},
"value": "n3",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 273,
"end": 293,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 275,
"end": 293,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 275,
"end": 281,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 284,
"end": 293,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": {
"type": "OptionalChainingExpression",
"span": {
"start": 296,
"end": 311,
"ctxt": 0
},
"questionDotToken": {
"start": 300,
"end": 301,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 296,
"end": 311,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 296,
"end": 300,
"ctxt": 0
},
"questionDotToken": {
"start": 297,
"end": 298,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 296,
"end": 300,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 296,
"end": 297,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 299,
"end": 300,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 303,
"end": 310,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 304,
"end": 305,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 307,
"end": 309,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
]
}
}
],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 329,
"end": 382,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 335,
"end": 381,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 335,
"end": 337,
"ctxt": 0
},
"value": "n4",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 337,
"end": 357,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 339,
"end": 357,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 339,
"end": 345,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 348,
"end": 357,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": {
"type": "OptionalChainingExpression",
"span": {
"start": 360,
"end": 381,
"ctxt": 0
},
"questionDotToken": {
"start": 364,
"end": 365,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 360,
"end": 381,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 360,
"end": 364,
"ctxt": 0
},
"questionDotToken": {
"start": 361,
"end": 362,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 360,
"end": 364,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 360,
"end": 361,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 363,
"end": 364,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 367,
"end": 380,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 368,
"end": 369,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "CallExpression",
"span": {
"start": 371,
"end": 379,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 371,
"end": 377,
"ctxt": 0
},
"value": "absorb",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
]
}
}
],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 447,
"end": 472,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 451,
"end": 471,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 451,
"end": 453,
"ctxt": 0
},
"value": "t1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "OptionalChainingExpression",
"span": {
"start": 456,
"end": 471,
"ctxt": 0
},
"questionDotToken": {
"start": 460,
"end": 461,
"ctxt": 0
},
"base": {
"type": "CallExpression",
"span": {
"start": 456,
"end": 471,
"ctxt": 0
},
"callee": {
"type": "OptionalChainingExpression",
"span": {
"start": 456,
"end": 460,
"ctxt": 0
},
"questionDotToken": {
"start": 457,
"end": 458,
"ctxt": 0
},
"base": {
"type": "MemberExpression",
"span": {
"start": 456,
"end": 460,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 456,
"end": 457,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 459,
"end": 460,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 463,
"end": 470,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 464,
"end": 465,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 467,
"end": 469,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
]
}
}
],
"typeArguments": null
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 473,
"end": 493,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 473,
"end": 492,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 473,
"end": 475,
"ctxt": 0
},
"value": "t1",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 478,
"end": 492,
"ctxt": 0
},
"callee": {
"type": "TsNonNullExpression",
"span": {
"start": 478,
"end": 483,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 478,
"end": 482,
"ctxt": 0
},
"object": {
"type": "TsNonNullExpression",
"span": {
"start": 478,
"end": 480,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 478,
"end": 479,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 481,
"end": 482,
"ctxt": 0
},
"value": "m",
"optional": false
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 484,
"end": 491,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 485,
"end": 486,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 488,
"end": 490,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
]
}
}
],
"typeArguments": null
}
}
}
],
"interpreter": null
}