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

394 lines
9.2 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 187,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 7,
"end": 11,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"declare": false,
"span": {
"start": 1,
"end": 94,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 18,
"end": 37,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 18,
"end": 21,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 18,
"end": 37,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 24,
"end": 37,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 26,
"end": 35,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 33,
"end": 34,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 42,
"end": 92,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 49,
"end": 55,
"ctxt": 0
},
"value": "create",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 42,
"end": 92,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 58,
"end": 92,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 68,
"end": 86,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 75,
"end": 85,
"ctxt": 0
},
"callee": {
"type": "ThisExpression",
"span": {
"start": 79,
"end": 83,
"ctxt": 0
}
},
"arguments": [],
"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": 102,
"end": 109,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"declare": false,
"span": {
"start": 96,
"end": 150,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 129,
"end": 148,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 129,
"end": 132,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 129,
"end": 148,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 135,
"end": 148,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 137,
"end": 146,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 144,
"end": 145,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 118,
"end": 122,
"ctxt": 0
},
"value": "Base",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 151,
"end": 176,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 155,
"end": 175,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 159,
"end": 175,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 159,
"end": 173,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 159,
"end": 166,
"ctxt": 0
},
"value": "Derived",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 167,
"end": 173,
"ctxt": 0
},
"value": "create",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 179,
"end": 187,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 179,
"end": 186,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 179,
"end": 184,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 179,
"end": 180,
"ctxt": 0
},
"value": "d",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 181,
"end": 184,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}