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

911 lines
24 KiB
JSON

{
"type": "Script",
"span": {
"start": 86,
"end": 759,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 92,
"end": 93,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 86,
"end": 161,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 100,
"end": 159,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 100,
"end": 111,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 112,
"end": 130,
"ctxt": 0
},
"decorators": [],
"accessibility": null,
"override": false,
"readonly": true,
"param": {
"type": "Identifier",
"span": {
"start": 121,
"end": 130,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 122,
"end": 130,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 124,
"end": 130,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 132,
"end": 159,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 142,
"end": 153,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 142,
"end": 152,
"ctxt": 0
},
"operator": "=",
"left": {
"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
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 151,
"end": 152,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 169,
"end": 170,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 163,
"end": 289,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 187,
"end": 287,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 187,
"end": 198,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 199,
"end": 208,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 199,
"end": 208,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 200,
"end": 208,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 202,
"end": 208,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 210,
"end": 287,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 220,
"end": 229,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 220,
"end": 228,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 220,
"end": 225,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 270,
"end": 281,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 270,
"end": 280,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 270,
"end": 276,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 270,
"end": 274,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 275,
"end": 276,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 279,
"end": 280,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 179,
"end": 180,
"ctxt": 0
},
"value": "A",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 297,
"end": 298,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 291,
"end": 525,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 446,
"end": 523,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 446,
"end": 457,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 458,
"end": 476,
"ctxt": 0
},
"decorators": [],
"accessibility": null,
"override": false,
"readonly": true,
"param": {
"type": "Identifier",
"span": {
"start": 467,
"end": 476,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 468,
"end": 476,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 470,
"end": 476,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 478,
"end": 523,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 488,
"end": 497,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 488,
"end": 496,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 488,
"end": 493,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 494,
"end": 495,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 506,
"end": 517,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 506,
"end": 516,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 506,
"end": 512,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 506,
"end": 510,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 511,
"end": 512,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 515,
"end": 516,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 307,
"end": 308,
"ctxt": 0
},
"value": "A",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 533,
"end": 534,
"ctxt": 0
},
"value": "D",
"optional": false
},
"declare": false,
"span": {
"start": 527,
"end": 610,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 541,
"end": 608,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 541,
"end": 552,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 553,
"end": 579,
"ctxt": 0
},
"decorators": [],
"accessibility": "private",
"override": false,
"readonly": true,
"param": {
"type": "Identifier",
"span": {
"start": 570,
"end": 579,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 571,
"end": 579,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 573,
"end": 579,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 581,
"end": 608,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 591,
"end": 602,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 591,
"end": 601,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 591,
"end": 597,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 591,
"end": 595,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 596,
"end": 597,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 600,
"end": 601,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 662,
"end": 663,
"ctxt": 0
},
"value": "E",
"optional": false
},
"declare": false,
"span": {
"start": 656,
"end": 759,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 680,
"end": 757,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 680,
"end": 691,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "TsParameterProperty",
"span": {
"start": 692,
"end": 710,
"ctxt": 0
},
"decorators": [],
"accessibility": null,
"override": false,
"readonly": true,
"param": {
"type": "Identifier",
"span": {
"start": 701,
"end": 710,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 702,
"end": 710,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 704,
"end": 710,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 712,
"end": 757,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 722,
"end": 731,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 722,
"end": 730,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 722,
"end": 727,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 728,
"end": 729,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 740,
"end": 751,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 740,
"end": 750,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 740,
"end": 746,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 740,
"end": 744,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 745,
"end": 746,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 749,
"end": 750,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 672,
"end": 673,
"ctxt": 0
},
"value": "D",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}