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

724 lines
22 KiB
JSON

{
"type": "Script",
"span": {
"start": 37,
"end": 387,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 43,
"end": 46,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 37,
"end": 342,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 53,
"end": 59,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 53,
"end": 58,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 54,
"end": 58,
"ctxt": 0
},
"value": "name",
"optional": false
}
},
"value": null,
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 65,
"end": 117,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 65,
"end": 76,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 77,
"end": 81,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 77,
"end": 81,
"ctxt": 0
},
"value": "name",
"optional": false,
"typeAnnotation": null
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 83,
"end": 117,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 93,
"end": 111,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 93,
"end": 110,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 93,
"end": 103,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 93,
"end": 97,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 98,
"end": 103,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 99,
"end": 103,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
},
"right": {
"type": "Identifier",
"span": {
"start": 106,
"end": 110,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
}
]
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 123,
"end": 340,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 123,
"end": 131,
"ctxt": 0
},
"value": "getValue",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 123,
"end": 340,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 135,
"end": 340,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 145,
"end": 162,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 151,
"end": 161,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 151,
"end": 154,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ThisExpression",
"span": {
"start": 157,
"end": 161,
"ctxt": 0
}
},
"definite": false
}
]
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 178,
"end": 181,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"declare": false,
"span": {
"start": 172,
"end": 294,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 196,
"end": 205,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 196,
"end": 198,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 197,
"end": 198,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 201,
"end": 204,
"ctxt": 0
},
"value": 100.0,
"raw": "100"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 219,
"end": 284,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 219,
"end": 230,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 220,
"end": 229,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 220,
"end": 223,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 224,
"end": 229,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 225,
"end": 229,
"ctxt": 0
},
"value": "name",
"optional": false
}
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 219,
"end": 284,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 233,
"end": 284,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 251,
"end": 270,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 258,
"end": 269,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 258,
"end": 259,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "MemberExpression",
"span": {
"start": 262,
"end": 269,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 262,
"end": 266,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 267,
"end": 269,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 268,
"end": 269,
"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": 304,
"end": 334,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 311,
"end": 333,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 311,
"end": 331,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 311,
"end": 320,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 315,
"end": 318,
"ctxt": 0
},
"value": "Bar",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Computed",
"span": {
"start": 320,
"end": 331,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 321,
"end": 330,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 321,
"end": 324,
"ctxt": 0
},
"value": "obj",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 325,
"end": 330,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 326,
"end": 330,
"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": 344,
"end": 387,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 344,
"end": 386,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 344,
"end": 355,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 344,
"end": 351,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 352,
"end": 355,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 356,
"end": 385,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 356,
"end": 380,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 356,
"end": 371,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 360,
"end": 363,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 364,
"end": 370,
"ctxt": 0
},
"value": "NAME",
"raw": "\"NAME\""
}
}
],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 372,
"end": 380,
"ctxt": 0
},
"value": "getValue",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 381,
"end": 384,
"ctxt": 0
},
"value": 100.0,
"raw": "100"
}
}
],
"typeArguments": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}