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

1444 lines
35 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 669,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 7,
"end": 8,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 1,
"end": 114,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 33,
"end": 38,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 34,
"end": 37,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 36,
"end": 37,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 36,
"end": 37,
"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": 43,
"end": 70,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 47,
"end": 48,
"ctxt": 0
},
"value": "X",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 43,
"end": 70,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 54,
"end": 70,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 56,
"end": 68,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 63,
"end": 67,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 50,
"end": 53,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 52,
"end": 53,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 52,
"end": 53,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 75,
"end": 112,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 75,
"end": 78,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 75,
"end": 112,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 84,
"end": 112,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 94,
"end": 106,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 101,
"end": 105,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 80,
"end": 83,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 82,
"end": 83,
"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": 8,
"end": 26,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 9,
"end": 25,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 9,
"end": 10,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsKeywordType",
"span": {
"start": 19,
"end": 25,
"ctxt": 0
},
"kind": "number"
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "D",
"optional": false
},
"declare": false,
"span": {
"start": 116,
"end": 368,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 148,
"end": 155,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 149,
"end": 154,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 151,
"end": 154,
"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": 160,
"end": 201,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"value": "X",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 160,
"end": 201,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 173,
"end": 201,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 183,
"end": 195,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 190,
"end": 194,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 167,
"end": 172,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 169,
"end": 172,
"ctxt": 0
},
"kind": "any"
}
}
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 206,
"end": 242,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 206,
"end": 209,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 206,
"end": 242,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 217,
"end": 242,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 227,
"end": 236,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 211,
"end": 216,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 213,
"end": 216,
"ctxt": 0
},
"kind": "any"
}
}
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassProperty",
"span": {
"start": 248,
"end": 262,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 256,
"end": 261,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 258,
"end": 261,
"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": 267,
"end": 315,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 278,
"end": 279,
"ctxt": 0
},
"value": "Y",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 267,
"end": 315,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 287,
"end": 315,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 297,
"end": 309,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 304,
"end": 308,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 281,
"end": 286,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 283,
"end": 286,
"ctxt": 0
},
"kind": "any"
}
}
},
"kind": "getter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 320,
"end": 366,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 327,
"end": 330,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 320,
"end": 366,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 338,
"end": 366,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 348,
"end": 360,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 355,
"end": 359,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 332,
"end": 337,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 334,
"end": 337,
"ctxt": 0
},
"kind": "any"
}
}
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "C",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 133,
"end": 141,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 134,
"end": 140,
"ctxt": 0
},
"kind": "number"
}
]
},
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 459,
"end": 460,
"ctxt": 0
},
"value": "E",
"optional": false
},
"declare": false,
"span": {
"start": 453,
"end": 590,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 495,
"end": 500,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 495,
"end": 496,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 496,
"end": 499,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 498,
"end": 499,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 498,
"end": 499,
"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": 505,
"end": 530,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 509,
"end": 510,
"ctxt": 0
},
"value": "X",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 505,
"end": 530,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 516,
"end": 530,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 518,
"end": 528,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 525,
"end": 527,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 512,
"end": 515,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 514,
"end": 515,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 514,
"end": 515,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 544,
"end": 588,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 544,
"end": 547,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 544,
"end": 588,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 553,
"end": 588,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 563,
"end": 573,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 570,
"end": 572,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 549,
"end": 552,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 551,
"end": 552,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 551,
"end": 552,
"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": 487,
"end": 488,
"ctxt": 0
},
"value": "D",
"optional": false
},
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 460,
"end": 478,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 461,
"end": 477,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 461,
"end": 462,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"constraint": {
"type": "TsKeywordType",
"span": {
"start": 471,
"end": 477,
"ctxt": 0
},
"kind": "string"
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 592,
"end": 609,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 596,
"end": 608,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 596,
"end": 597,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 597,
"end": 608,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 599,
"end": 608,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 599,
"end": 600,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 600,
"end": 608,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 601,
"end": 607,
"ctxt": 0
},
"kind": "number"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 610,
"end": 619,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 614,
"end": 618,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 614,
"end": 615,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 615,
"end": 618,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 617,
"end": 618,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 617,
"end": 618,
"ctxt": 0
},
"value": "D",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 620,
"end": 637,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 624,
"end": 636,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 624,
"end": 625,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 625,
"end": 636,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 627,
"end": 636,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 627,
"end": 628,
"ctxt": 0
},
"value": "E",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 628,
"end": 636,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 629,
"end": 635,
"ctxt": 0
},
"kind": "string"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 639,
"end": 645,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 639,
"end": 644,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 639,
"end": 640,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 643,
"end": 644,
"ctxt": 0
},
"value": "d",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 646,
"end": 652,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 646,
"end": 651,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 646,
"end": 647,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "Identifier",
"span": {
"start": 650,
"end": 651,
"ctxt": 0
},
"value": "e",
"optional": false
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 653,
"end": 669,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 657,
"end": 668,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 657,
"end": 658,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 661,
"end": 668,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 661,
"end": 666,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 661,
"end": 662,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 663,
"end": 666,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}