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

636 lines
15 KiB
JSON

{
"type": "Script",
"span": {
"start": 16,
"end": 335,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 16,
"end": 58,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 30,
"end": 56,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 42,
"end": 55,
"ctxt": 0
},
"value": "Hello world",
"raw": "\"Hello world\""
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 31,
"end": 39,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 33,
"end": 39,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"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": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 66,
"end": 67,
"ctxt": 0
},
"value": "D",
"optional": false
},
"declare": false,
"span": {
"start": 60,
"end": 164,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 74,
"end": 100,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 86,
"end": 99,
"ctxt": 0
},
"value": "Hello world",
"raw": "\"Hello world\""
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 75,
"end": 83,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 77,
"end": 83,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 105,
"end": 115,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 105,
"end": 106,
"ctxt": 0
},
"value": "y",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 106,
"end": 114,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 108,
"end": 114,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 120,
"end": 162,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 120,
"end": 131,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 134,
"end": 162,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 144,
"end": 156,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 144,
"end": 155,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 144,
"end": 148,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 153,
"end": 155,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "E",
"optional": false
},
"declare": false,
"span": {
"start": 166,
"end": 209,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 189,
"end": 207,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 189,
"end": 190,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 202,
"end": 206,
"ctxt": 0
},
"value": true
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 190,
"end": 199,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 192,
"end": 199,
"ctxt": 0
},
"kind": "boolean"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 182,
"end": 183,
"ctxt": 0
},
"value": "D",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 217,
"end": 218,
"ctxt": 0
},
"value": "F",
"optional": false
},
"declare": false,
"span": {
"start": 211,
"end": 335,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 234,
"end": 252,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": "z",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 247,
"end": 251,
"ctxt": 0
},
"value": true
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 235,
"end": 244,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 237,
"end": 244,
"ctxt": 0
},
"kind": "boolean"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 257,
"end": 267,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 257,
"end": 258,
"ctxt": 0
},
"value": "j",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 258,
"end": 266,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 260,
"end": 266,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 272,
"end": 333,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 272,
"end": 283,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 286,
"end": 333,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 296,
"end": 304,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 296,
"end": 303,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 296,
"end": 301,
"ctxt": 0
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 313,
"end": 327,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 313,
"end": 326,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 313,
"end": 319,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 313,
"end": 317,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 318,
"end": 319,
"ctxt": 0
},
"value": "j",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 322,
"end": 326,
"ctxt": 0
},
"value": "HI",
"raw": "\"HI\""
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": "D",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}