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

797 lines
20 KiB
JSON

{
"type": "Script",
"span": {
"start": 36,
"end": 574,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 36,
"end": 176,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "StaticBlock",
"span": {
"start": 50,
"end": 109,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 57,
"end": 109,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 67,
"end": 83,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 67,
"end": 82,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 67,
"end": 80,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 67,
"end": 68,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 69,
"end": 80,
"ctxt": 0
},
"value": "doSomething",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
}
},
{
"type": "ClassMethod",
"span": {
"start": 115,
"end": 174,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 122,
"end": 133,
"ctxt": 0
},
"value": "doSomething",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 115,
"end": 174,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 136,
"end": 174,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 145,
"end": 168,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 145,
"end": 167,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 145,
"end": 156,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 145,
"end": 152,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 153,
"end": 156,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 157,
"end": 166,
"ctxt": 0
},
"value": "gotcha!",
"raw": "\"gotcha!\""
}
}
],
"typeArguments": null
}
}
]
},
"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": 185,
"end": 188,
"ctxt": 0
},
"value": "Baz",
"optional": false
},
"declare": false,
"span": {
"start": 179,
"end": 255,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "StaticBlock",
"span": {
"start": 195,
"end": 253,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 202,
"end": 253,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 212,
"end": 229,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 212,
"end": 228,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 212,
"end": 223,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 212,
"end": 219,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 220,
"end": 223,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 224,
"end": 227,
"ctxt": 0
},
"value": "FOO",
"optional": false
}
}
],
"typeArguments": null
}
}
]
}
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 257,
"end": 275,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 263,
"end": 274,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 263,
"end": 266,
"ctxt": 0
},
"value": "FOO",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "StringLiteral",
"span": {
"start": 269,
"end": 274,
"ctxt": 0
},
"value": "FOO",
"raw": "\"FOO\""
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 282,
"end": 285,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"declare": false,
"span": {
"start": 276,
"end": 354,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "StaticBlock",
"span": {
"start": 292,
"end": 352,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 299,
"end": 352,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 309,
"end": 326,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 309,
"end": 325,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 309,
"end": 320,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 309,
"end": 316,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 317,
"end": 320,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 321,
"end": 324,
"ctxt": 0
},
"value": "FOO",
"optional": false
}
}
],
"typeArguments": null
}
}
]
}
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 356,
"end": 387,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 360,
"end": 386,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 360,
"end": 361,
"ctxt": 0
},
"value": "u",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 364,
"end": 386,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 364,
"end": 369,
"ctxt": 0
},
"value": "FOO",
"raw": "\"FOO\""
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 373,
"end": 386,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 373,
"end": 378,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 373,
"end": 378,
"ctxt": 0
},
"value": "FOO",
"raw": "\"FOO\""
}
},
{
"type": "TsLiteralType",
"span": {
"start": 381,
"end": 386,
"ctxt": 0
},
"literal": {
"type": "StringLiteral",
"span": {
"start": 381,
"end": 386,
"ctxt": 0
},
"value": "BAR",
"raw": "\"BAR\""
}
}
]
}
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 395,
"end": 398,
"ctxt": 0
},
"value": "CFA",
"optional": false
},
"declare": false,
"span": {
"start": 389,
"end": 570,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "StaticBlock",
"span": {
"start": 405,
"end": 469,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 412,
"end": 469,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 422,
"end": 432,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 422,
"end": 431,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 422,
"end": 423,
"ctxt": 0
},
"value": "u",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 426,
"end": 431,
"ctxt": 0
},
"value": "BAR",
"raw": "\"BAR\""
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 441,
"end": 443,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 441,
"end": 442,
"ctxt": 0
},
"value": "u",
"optional": false
}
}
]
}
},
{
"type": "ClassProperty",
"span": {
"start": 475,
"end": 488,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 482,
"end": 483,
"ctxt": 0
},
"value": "t",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 486,
"end": 487,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"typeAnnotation": null,
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 494,
"end": 517,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 501,
"end": 512,
"ctxt": 0
},
"value": "doSomething",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 494,
"end": 517,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 515,
"end": 517,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "StaticBlock",
"span": {
"start": 523,
"end": 568,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 530,
"end": 568,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 540,
"end": 542,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 540,
"end": 541,
"ctxt": 0
},
"value": "u",
"optional": false
}
}
]
}
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ExpressionStatement",
"span": {
"start": 572,
"end": 574,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 572,
"end": 573,
"ctxt": 0
},
"value": "u",
"optional": false
}
}
],
"interpreter": null
}