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

387 lines
9.8 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 35,
"end": 234,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 35,
"end": 114,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 49,
"end": 62,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 49,
"end": 53,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 50,
"end": 53,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 53,
"end": 61,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 55,
"end": 61,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 67,
"end": 112,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 67,
"end": 78,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 82,
"end": 112,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 92,
"end": 106,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 92,
"end": 105,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 92,
"end": 101,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 92,
"end": 96,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 97,
"end": 101,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 98,
"end": 101,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 104,
"end": 105,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 116,
"end": 234,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 140,
"end": 153,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 140,
"end": 144,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 141,
"end": 144,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 144,
"end": 152,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 146,
"end": 152,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 158,
"end": 232,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 158,
"end": 169,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 173,
"end": 232,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 183,
"end": 191,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 183,
"end": 190,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 183,
"end": 188,
"ctxt": 0
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 200,
"end": 226,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 200,
"end": 225,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 200,
"end": 209,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 200,
"end": 204,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 205,
"end": 209,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 206,
"end": 209,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 212,
"end": 225,
"ctxt": 0
},
"value": "some string",
"raw": "\"some string\""
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "A",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}