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

687 lines
21 KiB
JSON

{
"type": "Script",
"span": {
"start": 21,
"end": 400,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 27,
"end": 29,
"ctxt": 0
},
"value": "A3",
"optional": false
},
"declare": false,
"span": {
"start": 21,
"end": 400,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 36,
"end": 49,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 36,
"end": 43,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 37,
"end": 43,
"ctxt": 0
},
"value": "method",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 36,
"end": 49,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 46,
"end": 49,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "EmptyStatement",
"span": {
"start": 49,
"end": 50,
"ctxt": 0
}
},
{
"type": "Constructor",
"span": {
"start": 55,
"end": 398,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 55,
"end": 66,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 67,
"end": 72,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 67,
"end": 72,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 68,
"end": 72,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 70,
"end": 72,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 70,
"end": 72,
"ctxt": 0
},
"value": "A3",
"optional": false
},
"typeParams": null
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 74,
"end": 80,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 74,
"end": 80,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 75,
"end": 80,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 77,
"end": 80,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 82,
"end": 398,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 92,
"end": 115,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 92,
"end": 115,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 92,
"end": 104,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 92,
"end": 96,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 97,
"end": 104,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 98,
"end": 104,
"ctxt": 0
},
"value": "method",
"optional": false
}
}
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 107,
"end": 115,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 113,
"end": 115,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 148,
"end": 170,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 148,
"end": 169,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 148,
"end": 157,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 150,
"end": 157,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 151,
"end": 157,
"ctxt": 0
},
"value": "method",
"optional": false
}
}
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 160,
"end": 169,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 166,
"end": 169,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 203,
"end": 225,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 203,
"end": 225,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 203,
"end": 212,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 203,
"end": 204,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 205,
"end": 212,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 206,
"end": 212,
"ctxt": 0
},
"value": "method",
"optional": false
}
}
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 216,
"end": 225,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 222,
"end": 225,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 257,
"end": 296,
"ctxt": 0
},
"expression": {
"type": "ParenthesisExpression",
"span": {
"start": 257,
"end": 295,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 258,
"end": 294,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"span": {
"start": 258,
"end": 277,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 260,
"end": 261,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "MemberExpression",
"span": {
"start": 263,
"end": 275,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 263,
"end": 267,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 268,
"end": 275,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 269,
"end": 275,
"ctxt": 0
},
"value": "method",
"optional": false
}
}
}
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 280,
"end": 294,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "ArrowFunctionExpression",
"span": {
"start": 285,
"end": 293,
"ctxt": 0
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 291,
"end": 293,
"ctxt": 0
},
"stmts": []
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 328,
"end": 349,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 332,
"end": 348,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 332,
"end": 333,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 336,
"end": 348,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 336,
"end": 340,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 341,
"end": 348,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 342,
"end": 348,
"ctxt": 0
},
"value": "method",
"optional": false
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 358,
"end": 369,
"ctxt": 0
},
"expression": {
"type": "UpdateExpression",
"span": {
"start": 358,
"end": 369,
"ctxt": 0
},
"operator": "++",
"prefix": false,
"argument": {
"type": "MemberExpression",
"span": {
"start": 358,
"end": 367,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 358,
"end": 359,
"ctxt": 0
},
"value": "b",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 360,
"end": 367,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 361,
"end": 367,
"ctxt": 0
},
"value": "method",
"optional": false
}
}
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}