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

585 lines
16 KiB
JSON

{
"type": "Script",
"span": {
"start": 17,
"end": 253,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 23,
"end": 24,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 17,
"end": 253,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 31,
"end": 38,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 35,
"end": 37,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 43,
"end": 85,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 43,
"end": 54,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 57,
"end": 85,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 67,
"end": 79,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 67,
"end": 78,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 67,
"end": 73,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 67,
"end": 71,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 76,
"end": 78,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 90,
"end": 115,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 97,
"end": 100,
"ctxt": 0
},
"value": "log",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 101,
"end": 110,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 101,
"end": 110,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 102,
"end": 110,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 104,
"end": 110,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 90,
"end": 115,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 112,
"end": 115,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 120,
"end": 156,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 120,
"end": 123,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 120,
"end": 156,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 126,
"end": 156,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 136,
"end": 150,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 136,
"end": 149,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 136,
"end": 141,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "B",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 138,
"end": 141,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 142,
"end": 148,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 142,
"end": 146,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 162,
"end": 200,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 166,
"end": 167,
"ctxt": 0
},
"value": "X",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 162,
"end": 200,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 170,
"end": 200,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 180,
"end": 194,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 187,
"end": 193,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 187,
"end": 191,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 206,
"end": 251,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 210,
"end": 212,
"ctxt": 0
},
"value": "bX",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 213,
"end": 222,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 213,
"end": 222,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 214,
"end": 222,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 216,
"end": 222,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 206,
"end": 251,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 224,
"end": 251,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 234,
"end": 245,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 234,
"end": 244,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 234,
"end": 240,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 234,
"end": 238,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 243,
"end": 244,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}