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

849 lines
20 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 1,
"end": 318,
"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": 184,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 15,
"end": 43,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 22,
"end": 24,
"ctxt": 0
},
"value": "fn",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 15,
"end": 43,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 27,
"end": 43,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 29,
"end": 41,
"ctxt": 0
},
"argument": {
"type": "ThisExpression",
"span": {
"start": 36,
"end": 40,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 48,
"end": 76,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 59,
"end": 60,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 48,
"end": 76,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 63,
"end": 76,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 65,
"end": 74,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 81,
"end": 100,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 92,
"end": 93,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 81,
"end": 100,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 97,
"end": 100,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "Constructor",
"span": {
"start": 105,
"end": 157,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 105,
"end": 116,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 117,
"end": 133,
"ctxt": 0
},
"decorators": [],
"accessibility": "public",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 124,
"end": 133,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 125,
"end": 133,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 127,
"end": 133,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "TsParameterProperty",
"span": {
"start": 135,
"end": 152,
"ctxt": 0
},
"decorators": [],
"accessibility": "private",
"override": false,
"readonly": false,
"param": {
"type": "Identifier",
"span": {
"start": 143,
"end": 152,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 144,
"end": 152,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 146,
"end": 152,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 154,
"end": 157,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassProperty",
"span": {
"start": 162,
"end": 181,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 169,
"end": 172,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 172,
"end": 180,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 174,
"end": 180,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 186,
"end": 201,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 190,
"end": 200,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 190,
"end": 191,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 194,
"end": 200,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 194,
"end": 198,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 196,
"end": 198,
"ctxt": 0
},
"value": "fn",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 202,
"end": 215,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 206,
"end": 214,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 206,
"end": 208,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 211,
"end": 214,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"value": "r",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 216,
"end": 231,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 220,
"end": 230,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 220,
"end": 222,
"ctxt": 0
},
"value": "r3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 225,
"end": 230,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"value": "r",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 227,
"end": 230,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"value": "D",
"optional": false
},
"declare": false,
"span": {
"start": 233,
"end": 271,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 257,
"end": 269,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 257,
"end": 260,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 260,
"end": 268,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 262,
"end": 268,
"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": 249,
"end": 250,
"ctxt": 0
},
"value": "C",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 273,
"end": 288,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 277,
"end": 287,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 277,
"end": 278,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 281,
"end": 287,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 281,
"end": 285,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 281,
"end": 282,
"ctxt": 0
},
"value": "D",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 283,
"end": 285,
"ctxt": 0
},
"value": "fn",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 289,
"end": 302,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 293,
"end": 301,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 293,
"end": 295,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 298,
"end": 301,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 298,
"end": 299,
"ctxt": 0
},
"value": "r",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 300,
"end": 301,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 303,
"end": 318,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 307,
"end": 317,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 307,
"end": 309,
"ctxt": 0
},
"value": "r3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 312,
"end": 317,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": "r",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 314,
"end": 317,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"definite": false
}
]
}
],
"interpreter": null
}