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

896 lines
20 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 339,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 7,
"end": 8,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 1,
"end": 255,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 15,
"end": 33,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 23,
"end": 24,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 24,
"end": 32,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 26,
"end": 32,
"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": 38,
"end": 70,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 50,
"end": 51,
"ctxt": 0
},
"value": "y",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 38,
"end": 70,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 54,
"end": 70,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 56,
"end": 68,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 63,
"end": 67,
"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": 75,
"end": 95,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
},
"value": "y",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 75,
"end": 95,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 92,
"end": 95,
"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": 100,
"end": 117,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 108,
"end": 111,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 100,
"end": 117,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 114,
"end": 117,
"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": 123,
"end": 148,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 138,
"end": 139,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 139,
"end": 147,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 141,
"end": 147,
"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": 153,
"end": 192,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "b",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 153,
"end": 192,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 176,
"end": 192,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 178,
"end": 190,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 185,
"end": 189,
"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": 197,
"end": 224,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 216,
"end": 217,
"ctxt": 0
},
"value": "b",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 218,
"end": 219,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 218,
"end": 219,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 197,
"end": 224,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 221,
"end": 224,
"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": 229,
"end": 253,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 244,
"end": 247,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 229,
"end": 253,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 250,
"end": 253,
"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": 257,
"end": 266,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 261,
"end": 265,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 261,
"end": 262,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 262,
"end": 265,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 264,
"end": 265,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 281,
"end": 285,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 281,
"end": 284,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 281,
"end": 282,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 286,
"end": 290,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 286,
"end": 289,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 286,
"end": 287,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 288,
"end": 289,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 291,
"end": 299,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 291,
"end": 298,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 291,
"end": 294,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 291,
"end": 292,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 293,
"end": 294,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 297,
"end": 298,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 300,
"end": 308,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 300,
"end": 307,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 300,
"end": 305,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 300,
"end": 301,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 302,
"end": 305,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 310,
"end": 314,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 310,
"end": 313,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 310,
"end": 311,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 315,
"end": 321,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 315,
"end": 320,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 315,
"end": 318,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 315,
"end": 316,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 317,
"end": 318,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 322,
"end": 330,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 322,
"end": 329,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 322,
"end": 325,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 322,
"end": 323,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 324,
"end": 325,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 331,
"end": 339,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 331,
"end": 338,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 331,
"end": 336,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 333,
"end": 336,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}