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

1309 lines
40 KiB
JSON

{
"type": "Script",
"span": {
"start": 21,
"end": 480,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 21,
"end": 86,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 25,
"end": 85,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 25,
"end": 32,
"ctxt": 0
},
"value": "friendA",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 32,
"end": 85,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 34,
"end": 85,
"ctxt": 0
},
"members": [
{
"type": "TsMethodSignature",
"span": {
"start": 36,
"end": 55,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 36,
"end": 40,
"ctxt": 0
},
"value": "getX",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 41,
"end": 45,
"ctxt": 0
},
"value": "o",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 42,
"end": 45,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 44,
"end": 45,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 44,
"end": 45,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 46,
"end": 54,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 48,
"end": 54,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsMethodSignature",
"span": {
"start": 56,
"end": 83,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 56,
"end": 60,
"ctxt": 0
},
"value": "setX",
"optional": false
},
"computed": false,
"optional": false,
"params": [
{
"type": "Identifier",
"span": {
"start": 61,
"end": 65,
"ctxt": 0
},
"value": "o",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 62,
"end": 65,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 64,
"end": 65,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 64,
"end": 65,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "Identifier",
"span": {
"start": 67,
"end": 76,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 68,
"end": 76,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 70,
"end": 76,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnn": {
"type": "TsTypeAnnotation",
"span": {
"start": 77,
"end": 83,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 79,
"end": 83,
"ctxt": 0
},
"kind": "void"
}
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 94,
"end": 95,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 88,
"end": 316,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 100,
"end": 111,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 100,
"end": 102,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 102,
"end": 110,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 104,
"end": 110,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 115,
"end": 161,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 115,
"end": 126,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 128,
"end": 137,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 128,
"end": 137,
"ctxt": 0
},
"value": "v",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 129,
"end": 137,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 131,
"end": 137,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 139,
"end": 161,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 145,
"end": 157,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 145,
"end": 156,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 145,
"end": 152,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 145,
"end": 149,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 150,
"end": 152,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"value": "v",
"optional": false
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 165,
"end": 198,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 165,
"end": 169,
"ctxt": 0
},
"value": "getX",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 165,
"end": 198,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 173,
"end": 198,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 179,
"end": 194,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 186,
"end": 193,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 186,
"end": 190,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 191,
"end": 193,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "StaticBlock",
"span": {
"start": 202,
"end": 314,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 209,
"end": 314,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 215,
"end": 310,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 215,
"end": 309,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 215,
"end": 222,
"ctxt": 0
},
"value": "friendA",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 225,
"end": 309,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 233,
"end": 237,
"ctxt": 0
},
"value": "getX",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 238,
"end": 241,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 238,
"end": 241,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 233,
"end": 260,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 243,
"end": 260,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 245,
"end": 258,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 252,
"end": 258,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 252,
"end": 255,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 256,
"end": 258,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 257,
"end": 258,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 268,
"end": 272,
"ctxt": 0
},
"value": "setX",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 273,
"end": 276,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 273,
"end": 276,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 278,
"end": 283,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 278,
"end": 283,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 268,
"end": 303,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 285,
"end": 303,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 287,
"end": 301,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 287,
"end": 301,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 287,
"end": 293,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 287,
"end": 290,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 291,
"end": 293,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 292,
"end": 293,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 296,
"end": 301,
"ctxt": 0
},
"value": "value",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
}
]
}
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "EmptyStatement",
"span": {
"start": 316,
"end": 317,
"ctxt": 0
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 325,
"end": 326,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 319,
"end": 427,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 331,
"end": 425,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 331,
"end": 342,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 343,
"end": 347,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 343,
"end": 347,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 344,
"end": 347,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 346,
"end": 347,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 346,
"end": 347,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 349,
"end": 425,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 355,
"end": 381,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 361,
"end": 380,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 361,
"end": 362,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 365,
"end": 380,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 365,
"end": 377,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 365,
"end": 372,
"ctxt": 0
},
"value": "friendA",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 373,
"end": 377,
"ctxt": 0
},
"value": "getX",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 378,
"end": 379,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 392,
"end": 415,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 392,
"end": 414,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 392,
"end": 404,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 392,
"end": 399,
"ctxt": 0
},
"value": "friendA",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 400,
"end": 404,
"ctxt": 0
},
"value": "setX",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 405,
"end": 406,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
{
"spread": null,
"expression": {
"type": "BinaryExpression",
"span": {
"start": 408,
"end": 413,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 408,
"end": 409,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 412,
"end": 413,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
],
"typeArguments": null
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "EmptyStatement",
"span": {
"start": 427,
"end": 428,
"ctxt": 0
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 430,
"end": 450,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 436,
"end": 449,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 436,
"end": 437,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 440,
"end": 449,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 444,
"end": 445,
"ctxt": 0
},
"value": "A",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 446,
"end": 448,
"ctxt": 0
},
"value": 41.0,
"raw": "41"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 451,
"end": 470,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 457,
"end": 469,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 457,
"end": 458,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 461,
"end": 469,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 465,
"end": 466,
"ctxt": 0
},
"value": "B",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 467,
"end": 468,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 471,
"end": 480,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 471,
"end": 479,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 471,
"end": 477,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 471,
"end": 472,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 473,
"end": 477,
"ctxt": 0
},
"value": "getX",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}