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

604 lines
16 KiB
JSON

{
"type": "Script",
"span": {
"start": 35,
"end": 521,
"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": 193,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 49,
"end": 69,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 56,
"end": 60,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 57,
"end": 60,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 60,
"end": 68,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 62,
"end": 68,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": true,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "PrivateProperty",
"span": {
"start": 74,
"end": 94,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 81,
"end": 85,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 82,
"end": 85,
"ctxt": 0
},
"value": "bar",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 87,
"end": 93,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": true,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 99,
"end": 191,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 99,
"end": 110,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 114,
"end": 191,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 124,
"end": 135,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 124,
"end": 134,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 124,
"end": 130,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": "A",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 126,
"end": 130,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 127,
"end": 130,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 133,
"end": 134,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 144,
"end": 151,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 144,
"end": 145,
"ctxt": 0
},
"value": "B",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 146,
"end": 150,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 147,
"end": 150,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 169,
"end": 176,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 169,
"end": 175,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 169,
"end": 170,
"ctxt": 0
},
"value": "B",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 171,
"end": 175,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 172,
"end": 175,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 201,
"end": 202,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 195,
"end": 317,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 219,
"end": 239,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 226,
"end": 230,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 227,
"end": 230,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 230,
"end": 238,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 232,
"end": 238,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": true,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "Constructor",
"span": {
"start": 244,
"end": 315,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 244,
"end": 255,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [],
"body": {
"type": "BlockStatement",
"span": {
"start": 259,
"end": 315,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 269,
"end": 277,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 269,
"end": 276,
"ctxt": 0
},
"callee": {
"type": "Super",
"span": {
"start": 269,
"end": 274,
"ctxt": 0
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 286,
"end": 309,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 286,
"end": 308,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 286,
"end": 292,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 286,
"end": 287,
"ctxt": 0
},
"value": "B",
"optional": false
},
"property": {
"type": "PrivateName",
"span": {
"start": 288,
"end": 292,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 289,
"end": 292,
"ctxt": 0
},
"value": "foo",
"optional": false
}
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 295,
"end": 308,
"ctxt": 0
},
"value": "some string",
"raw": "\"some string\""
}
}
}
]
},
"accessibility": null,
"isOptional": false
}
],
"superClass": {
"type": "Identifier",
"span": {
"start": 211,
"end": 212,
"ctxt": 0
},
"value": "A",
"optional": false
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 477,
"end": 521,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 483,
"end": 520,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 483,
"end": 499,
"ctxt": 0
},
"value": "willErrorSomeDay",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 499,
"end": 509,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeQuery",
"span": {
"start": 501,
"end": 509,
"ctxt": 0
},
"exprName": {
"type": "Identifier",
"span": {
"start": 508,
"end": 509,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeArguments": null
}
}
},
"init": {
"type": "ClassExpression",
"identifier": null,
"span": {
"start": 512,
"end": 520,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
"definite": false
}
]
}
],
"interpreter": null
}