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

730 lines
23 KiB
JSON

{
"type": "Script",
"span": {
"start": 28,
"end": 378,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 34,
"end": 37,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 28,
"end": 333,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 44,
"end": 50,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 44,
"end": 49,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 45,
"end": 49,
"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": 56,
"end": 108,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 56,
"end": 67,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 68,
"end": 72,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 68,
"end": 72,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": null
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 74,
"end": 108,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 84,
"end": 102,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 84,
"end": 101,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 84,
"end": 94,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 84,
"end": 88,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 89,
"end": 94,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 90,
"end": 94,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 97,
"end": 101,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 114,
"end": 331,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 114,
"end": 122,
"ctxt": 0
},
"value": "getValue",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 123,
"end": 124,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 114,
"end": 331,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 126,
"end": 331,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 136,
"end": 153,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 142,
"end": 152,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 142,
"end": 145,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ThisExpression",
"span": {
"start": 148,
"end": 152,
"ctxt": 0
}
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 169,
"end": 172,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"declare": false,
"span": {
"start": 163,
"end": 285,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 187,
"end": 196,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 187,
"end": 189,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 192,
"end": 195,
"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": 210,
"end": 275,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 210,
"end": 221,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 211,
"end": 220,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 211,
"end": 214,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 215,
"end": 220,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 216,
"end": 220,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 210,
"end": 275,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 224,
"end": 275,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 242,
"end": 261,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 249,
"end": 260,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 249,
"end": 250,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "MemberExpression",
"span": {
"start": 253,
"end": 260,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 253,
"end": 257,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 258,
"end": 260,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 259,
"end": 260,
"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": 295,
"end": 325,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 302,
"end": 324,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 302,
"end": 322,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 302,
"end": 311,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 306,
"end": 309,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Computed",
"span": {
"start": 311,
"end": 322,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 312,
"end": 321,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 312,
"end": 315,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 316,
"end": 321,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 317,
"end": 321,
"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": 335,
"end": 378,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 335,
"end": 377,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 335,
"end": 346,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 335,
"end": 342,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 343,
"end": 346,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 347,
"end": 376,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 347,
"end": 371,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 347,
"end": 362,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 351,
"end": 354,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 355,
"end": 361,
"ctxt": 0
},
"value": "NAME",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 363,
"end": 371,
"ctxt": 0
},
"value": "getValue",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 372,
"end": 375,
"ctxt": 0
},
"value": 100.0
}
}
],
"typeArguments": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}