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

1443 lines
35 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 0,
"end": 668,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 0,
"end": 113,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 32,
"end": 37,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 32,
"end": 33,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 33,
"end": 36,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 35,
"end": 36,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 35,
"end": 36,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 42,
"end": 69,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 46,
"end": 47,
"ctxt": 0
},
"value": "X",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 42,
"end": 69,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 53,
"end": 69,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 55,
"end": 67,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 62,
"end": 66,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 49,
"end": 52,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 74,
"end": 111,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 74,
"end": 77,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 74,
"end": 111,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 83,
"end": 111,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 93,
"end": 105,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 100,
"end": 104,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 79,
"end": 82,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 81,
"end": 82,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 81,
"end": 82,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 7,
"end": 25,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 8,
"end": 24,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 8,
"end": 9,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsKeywordType",
"span": {
"start": 18,
"end": 24,
"ctxt": 0
},
"kind": "number"
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": "D",
"optional": false
},
"declare": false,
"span": {
"start": 115,
"end": 367,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 147,
"end": 154,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 148,
"end": 153,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 150,
"end": 153,
"ctxt": 0
},
"kind": "any"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 159,
"end": 200,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 163,
"end": 164,
"ctxt": 0
},
"value": "X",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 159,
"end": 200,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 172,
"end": 200,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 182,
"end": 194,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 189,
"end": 193,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 166,
"end": 171,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 168,
"end": 171,
"ctxt": 0
},
"kind": "any"
}
}
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 205,
"end": 241,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 205,
"end": 208,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 205,
"end": 241,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 216,
"end": 241,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 226,
"end": 235,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 233,
"end": 234,
"ctxt": 0
},
"value": 1.0
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 210,
"end": 215,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 212,
"end": 215,
"ctxt": 0
},
"kind": "any"
}
}
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassProperty",
"span": {
"start": 247,
"end": 261,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 254,
"end": 255,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 255,
"end": 260,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 257,
"end": 260,
"ctxt": 0
},
"kind": "any"
}
},
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 266,
"end": 314,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 277,
"end": 278,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 266,
"end": 314,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 286,
"end": 314,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 296,
"end": 308,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 303,
"end": 307,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 280,
"end": 285,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 282,
"end": 285,
"ctxt": 0
},
"kind": "any"
}
}
},
"kind": "getter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 319,
"end": 365,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 326,
"end": 329,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 319,
"end": 365,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 337,
"end": 365,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 347,
"end": 359,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 354,
"end": 358,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 331,
"end": 336,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 333,
"end": 336,
"ctxt": 0
},
"kind": "any"
}
}
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "C",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 132,
"end": 140,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 133,
"end": 139,
"ctxt": 0
},
"kind": "number"
}
]
},
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 458,
"end": 459,
"ctxt": 0
},
"value": "E",
"optional": false
},
"declare": false,
"span": {
"start": 452,
"end": 589,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 494,
"end": 499,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 494,
"end": 495,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 495,
"end": 498,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 497,
"end": 498,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 497,
"end": 498,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 504,
"end": 529,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 508,
"end": 509,
"ctxt": 0
},
"value": "X",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 504,
"end": 529,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 515,
"end": 529,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 517,
"end": 527,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 524,
"end": 526,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 511,
"end": 514,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 513,
"end": 514,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 513,
"end": 514,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 543,
"end": 587,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 543,
"end": 546,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 543,
"end": 587,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 552,
"end": 587,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 562,
"end": 572,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 569,
"end": 571,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 548,
"end": 551,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 550,
"end": 551,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 550,
"end": 551,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 486,
"end": 487,
"ctxt": 0
},
"value": "D",
"optional": false
},
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 459,
"end": 477,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 460,
"end": 476,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 460,
"end": 461,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsKeywordType",
"span": {
"start": 470,
"end": 476,
"ctxt": 0
},
"kind": "string"
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 591,
"end": 608,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 595,
"end": 607,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 595,
"end": 596,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 596,
"end": 607,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 598,
"end": 607,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 598,
"end": 599,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 599,
"end": 607,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 600,
"end": 606,
"ctxt": 0
},
"kind": "number"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 609,
"end": 618,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 613,
"end": 617,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 613,
"end": 614,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 614,
"end": 617,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 616,
"end": 617,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 616,
"end": 617,
"ctxt": 0
},
"value": "D",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 619,
"end": 636,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 623,
"end": 635,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 623,
"end": 624,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 624,
"end": 635,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 626,
"end": 635,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 626,
"end": 627,
"ctxt": 0
},
"value": "E",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 627,
"end": 635,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 628,
"end": 634,
"ctxt": 0
},
"kind": "string"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 638,
"end": 644,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 638,
"end": 643,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 638,
"end": 639,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 642,
"end": 643,
"ctxt": 0
},
"value": "d",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 645,
"end": 651,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 645,
"end": 650,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 645,
"end": 646,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 649,
"end": 650,
"ctxt": 0
},
"value": "e",
"optional": false
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 652,
"end": 668,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 656,
"end": 667,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 656,
"end": 657,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 660,
"end": 667,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 660,
"end": 665,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 660,
"end": 661,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 662,
"end": 665,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}