swc/crates/swc_ecma_parser/tests/tsc/privateNameReadonly.json
2022-03-22 07:54:08 +00:00

363 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 20,
"end": 163,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 20,
"end": 134,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 26,
"end": 134,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 26,
"end": 27,
"ctxt": 0
},
"value": "C",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ClassExpression",
"identifier": null,
"span": {
"start": 30,
"end": 134,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 42,
"end": 51,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 42,
"end": 46,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 43,
"end": 46,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 42,
"end": 51,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 49,
"end": 51,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 56,
"end": 132,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 56,
"end": 59,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 56,
"end": 132,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 62,
"end": 132,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 72,
"end": 126,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 72,
"end": 125,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 72,
"end": 81,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 72,
"end": 76,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 77,
"end": 81,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 78,
"end": 81,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 84,
"end": 125,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 84,
"end": 95,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 84,
"end": 91,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 92,
"end": 95,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 96,
"end": 124,
"ctxt": 0
},
"value": "should log this then throw",
"raw": "\"should log this then throw\""
}
}
],
"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": []
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 136,
"end": 163,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 136,
"end": 162,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 136,
"end": 147,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 136,
"end": 143,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 144,
"end": 147,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 148,
"end": 161,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 148,
"end": 159,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 148,
"end": 155,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 152,
"end": 153,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 156,
"end": 159,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}