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

363 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 21,
"end": 164,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 21,
"end": 135,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 27,
"end": 135,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 27,
"end": 28,
"ctxt": 0
},
"value": "C",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ClassExpression",
"identifier": null,
"span": {
"start": 31,
"end": 135,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateMethod",
"span": {
"start": 43,
"end": 52,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 43,
"end": 47,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 44,
"end": 47,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 43,
"end": 52,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 50,
"end": 52,
"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": 57,
"end": 133,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 57,
"end": 60,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 57,
"end": 133,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 63,
"end": 133,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 73,
"end": 127,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 73,
"end": 126,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 73,
"end": 82,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 73,
"end": 77,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 78,
"end": 82,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 79,
"end": 82,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 85,
"end": 126,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 85,
"end": 96,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 85,
"end": 92,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 93,
"end": 96,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 97,
"end": 125,
"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": 137,
"end": 164,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 137,
"end": 163,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 137,
"end": 148,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 137,
"end": 144,
"ctxt": 0
},
"value": "console",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 145,
"end": 148,
"ctxt": 0
},
"value": "log",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 149,
"end": 162,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 149,
"end": 160,
"ctxt": 0
},
"object": {
"type": "NewExpression",
"span": {
"start": 149,
"end": 156,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"property": {
"type": "Identifier",
"span": {
"start": 157,
"end": 160,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}