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

894 lines
20 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 338,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 0,
"end": 254,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 14,
"end": 32,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 23,
"end": 31,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 25,
"end": 31,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": "private",
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 37,
"end": 69,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 49,
"end": 50,
"ctxt": 0
},
"value": "y",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 37,
"end": 69,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 53,
"end": 69,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 55,
"end": 67,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 62,
"end": 66,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": "private",
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 74,
"end": 94,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 86,
"end": 87,
"ctxt": 0
},
"value": "y",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 74,
"end": 94,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 91,
"end": 94,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": "private",
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 99,
"end": 116,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 107,
"end": 110,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 99,
"end": 116,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 113,
"end": 116,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": "private",
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassProperty",
"span": {
"start": 122,
"end": 147,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 137,
"end": 138,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 138,
"end": 146,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 140,
"end": 146,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": true,
"decorators": [],
"accessibility": "private",
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 152,
"end": 191,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 171,
"end": 172,
"ctxt": 0
},
"value": "b",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 152,
"end": 191,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 175,
"end": 191,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 177,
"end": 189,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 184,
"end": 188,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": true,
"accessibility": "private",
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 196,
"end": 223,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 215,
"end": 216,
"ctxt": 0
},
"value": "b",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 217,
"end": 218,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 217,
"end": 218,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 196,
"end": 223,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 220,
"end": 223,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": true,
"accessibility": "private",
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 228,
"end": 252,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 243,
"end": 246,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 228,
"end": 252,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 249,
"end": 252,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": "private",
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 256,
"end": 265,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 260,
"end": 264,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 260,
"end": 261,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 261,
"end": 264,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 263,
"end": 264,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 280,
"end": 284,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 280,
"end": 283,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 280,
"end": 281,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 285,
"end": 289,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 285,
"end": 288,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 285,
"end": 286,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 290,
"end": 298,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 290,
"end": 297,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 290,
"end": 293,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 290,
"end": 291,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 292,
"end": 293,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 296,
"end": 297,
"ctxt": 0
},
"value": 1.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 299,
"end": 307,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 299,
"end": 306,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 299,
"end": 304,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 299,
"end": 300,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 301,
"end": 304,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 309,
"end": 313,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 309,
"end": 312,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 311,
"end": 312,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 314,
"end": 320,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 314,
"end": 319,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 314,
"end": 317,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 314,
"end": 315,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 316,
"end": 317,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 321,
"end": 329,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 321,
"end": 328,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 321,
"end": 324,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 321,
"end": 322,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 323,
"end": 324,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 327,
"end": 328,
"ctxt": 0
},
"value": 1.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 330,
"end": 338,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 330,
"end": 337,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 330,
"end": 335,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 332,
"end": 335,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}