swc/crates/swc_ecma_parser/tests/tsc/privateNamesAndFields.json
2022-04-05 12:46:35 +00:00

387 lines
9.8 KiB
JSON

{
"type": "Script",
"span": {
"start": 34,
"end": 233,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 40,
"end": 41,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 34,
"end": 113,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 48,
"end": 61,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 48,
"end": 52,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 49,
"end": 52,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 52,
"end": 60,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 54,
"end": 60,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 66,
"end": 111,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 66,
"end": 77,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 81,
"end": 111,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 91,
"end": 105,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 91,
"end": 104,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 91,
"end": 100,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 91,
"end": 95,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 96,
"end": 100,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 97,
"end": 100,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 103,
"end": 104,
"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": 121,
"end": 122,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 115,
"end": 233,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 139,
"end": 152,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 139,
"end": 143,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 140,
"end": 143,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 143,
"end": 151,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 145,
"end": 151,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 157,
"end": 231,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 157,
"end": 168,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 172,
"end": 231,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 182,
"end": 190,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 182,
"end": 189,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 182,
"end": 187,
"ctxt": 0
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 199,
"end": 225,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 199,
"end": 224,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 199,
"end": 208,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 199,
"end": 203,
"ctxt": 0
}
},
"property": {
"type": "PrivateName",
"span": {
"start": 204,
"end": 208,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 205,
"end": 208,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 211,
"end": 224,
"ctxt": 0
},
"value": "some string",
"raw": "\"some string\""
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": "A",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}