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

1414 lines
34 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 417,
"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": 68,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 15,
"end": 27,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 15,
"end": 18,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 18,
"end": 26,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 20,
"end": 26,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 32,
"end": 43,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 32,
"end": 37,
"ctxt": 0
},
"value": "thing",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 32,
"end": 43,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 40,
"end": 43,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 48,
"end": 66,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 55,
"end": 60,
"ctxt": 0
},
"value": "other",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 48,
"end": 66,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 63,
"end": 66,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 76,
"end": 77,
"ctxt": 0
},
"value": "D",
"optional": false
},
"declare": false,
"span": {
"start": 70,
"end": 108,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 94,
"end": 106,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 94,
"end": 97,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 97,
"end": 105,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 99,
"end": 105,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 86,
"end": 87,
"ctxt": 0
},
"value": "C",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 110,
"end": 119,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 114,
"end": 118,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 114,
"end": 115,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 115,
"end": 118,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 117,
"end": 118,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 117,
"end": 118,
"ctxt": 0
},
"value": "D",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 120,
"end": 134,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 124,
"end": 133,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 128,
"end": 133,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 130,
"end": 133,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 135,
"end": 150,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 139,
"end": 149,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 139,
"end": 141,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 144,
"end": 149,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 144,
"end": 145,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 146,
"end": 149,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 151,
"end": 170,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 155,
"end": 169,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 155,
"end": 157,
"ctxt": 0
},
"value": "r3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 160,
"end": 169,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 160,
"end": 167,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 160,
"end": 161,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 162,
"end": 167,
"ctxt": 0
},
"value": "thing",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 171,
"end": 190,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 175,
"end": 189,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 175,
"end": 177,
"ctxt": 0
},
"value": "r4",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 180,
"end": 189,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 180,
"end": 187,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": "D",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 182,
"end": 187,
"ctxt": 0
},
"value": "other",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 198,
"end": 200,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"declare": false,
"span": {
"start": 192,
"end": 269,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 210,
"end": 217,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 210,
"end": 213,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 213,
"end": 216,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 215,
"end": 216,
"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": 222,
"end": 237,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 222,
"end": 227,
"ctxt": 0
},
"value": "thing",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 228,
"end": 232,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 228,
"end": 232,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 229,
"end": 232,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 231,
"end": 232,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 231,
"end": 232,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 222,
"end": 237,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 234,
"end": 237,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 242,
"end": 267,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 249,
"end": 254,
"ctxt": 0
},
"value": "other",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 258,
"end": 262,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 258,
"end": 262,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 259,
"end": 262,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 242,
"end": 267,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 264,
"end": 267,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 254,
"end": 257,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
}
]
},
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 200,
"end": 203,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 277,
"end": 279,
"ctxt": 0
},
"value": "D2",
"optional": false
},
"declare": false,
"span": {
"start": 271,
"end": 317,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 303,
"end": 315,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 303,
"end": 306,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 306,
"end": 314,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 308,
"end": 314,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 291,
"end": 293,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 279,
"end": 282,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 280,
"end": 281,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 280,
"end": 281,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
}
]
},
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 293,
"end": 296,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 294,
"end": 295,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 294,
"end": 295,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
]
},
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 319,
"end": 338,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 323,
"end": 337,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 323,
"end": 325,
"ctxt": 0
},
"value": "d2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 325,
"end": 337,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 327,
"end": 337,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 327,
"end": 329,
"ctxt": 0
},
"value": "D2",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 329,
"end": 337,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 330,
"end": 336,
"ctxt": 0
},
"kind": "string"
}
]
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 339,
"end": 355,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 343,
"end": 354,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 343,
"end": 345,
"ctxt": 0
},
"value": "r5",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 348,
"end": 354,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 348,
"end": 350,
"ctxt": 0
},
"value": "d2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 351,
"end": 354,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 356,
"end": 372,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 360,
"end": 371,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 360,
"end": 362,
"ctxt": 0
},
"value": "r6",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 365,
"end": 371,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 365,
"end": 367,
"ctxt": 0
},
"value": "d2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 368,
"end": 371,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 373,
"end": 395,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 377,
"end": 394,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 377,
"end": 379,
"ctxt": 0
},
"value": "r7",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 382,
"end": 394,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 382,
"end": 390,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 382,
"end": 384,
"ctxt": 0
},
"value": "d2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 385,
"end": 390,
"ctxt": 0
},
"value": "thing",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 391,
"end": 393,
"ctxt": 0
},
"value": "",
"raw": "''"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 396,
"end": 417,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 400,
"end": 416,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 400,
"end": 402,
"ctxt": 0
},
"value": "r8",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 405,
"end": 416,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 405,
"end": 413,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 405,
"end": 407,
"ctxt": 0
},
"value": "D2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 408,
"end": 413,
"ctxt": 0
},
"value": "other",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 414,
"end": 415,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}