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

730 lines
23 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 36,
"end": 386,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 42,
"end": 45,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 36,
"end": 341,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 52,
"end": 58,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 52,
"end": 57,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 53,
"end": 57,
"ctxt": 0
},
"value": "name",
"optional": false
}
},
"value": null,
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"computed": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 64,
"end": 116,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 64,
"end": 75,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 76,
"end": 80,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 76,
"end": 80,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": null
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 82,
"end": 116,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 92,
"end": 110,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 92,
"end": 109,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 92,
"end": 102,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 92,
"end": 96,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 97,
"end": 102,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 98,
"end": 102,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 105,
"end": 109,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 122,
"end": 339,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 122,
"end": 130,
"ctxt": 0
},
"value": "getValue",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 122,
"end": 339,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 134,
"end": 339,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 144,
"end": 161,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 150,
"end": 160,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 150,
"end": 153,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ThisExpression",
"span": {
"start": 156,
"end": 160,
"ctxt": 0
}
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 177,
"end": 180,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"declare": false,
"span": {
"start": 171,
"end": 293,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 195,
"end": 204,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 195,
"end": 197,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 200,
"end": 203,
"ctxt": 0
},
"value": 100.0
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"computed": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 218,
"end": 283,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 218,
"end": 229,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 219,
"end": 228,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 219,
"end": 222,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 223,
"end": 228,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 224,
"end": 228,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 218,
"end": 283,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 232,
"end": 283,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 250,
"end": 269,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 257,
"end": 268,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 257,
"end": 258,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "MemberExpression",
"span": {
"start": 261,
"end": 268,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 261,
"end": 265,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 266,
"end": 268,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 267,
"end": 268,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ReturnStatement",
"span": {
"start": 303,
"end": 333,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 310,
"end": 332,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 310,
"end": 330,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 310,
"end": 319,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 314,
"end": 317,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Computed",
"span": {
"start": 319,
"end": 330,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 320,
"end": 329,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 320,
"end": 323,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 324,
"end": 329,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 325,
"end": 329,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
}
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ExpressionStatement",
"span": {
"start": 343,
"end": 386,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 343,
"end": 385,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 343,
"end": 354,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 343,
"end": 350,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 351,
"end": 354,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 355,
"end": 384,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 355,
"end": 379,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 355,
"end": 370,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 359,
"end": 362,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 363,
"end": 369,
"ctxt": 0
},
"value": "NAME",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 371,
"end": 379,
"ctxt": 0
},
"value": "getValue",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 380,
"end": 383,
"ctxt": 0
},
"value": 100.0
}
}
],
"typeArguments": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}