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

772 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 34,
"end": 417,
"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": 183,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 48,
"end": 62,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 48,
"end": 57,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 49,
"end": 57,
"ctxt": 0
},
"value": "fooField",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 60,
"end": 61,
"ctxt": 0
},
"value": 3.0
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "PrivateMethod",
"span": {
"start": 67,
"end": 83,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 67,
"end": 77,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 68,
"end": 77,
"ctxt": 0
},
"value": "fooMethod",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 67,
"end": 83,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 80,
"end": 83,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "EmptyStatement",
"span": {
"start": 83,
"end": 84,
"ctxt": 0
}
},
{
"type": "PrivateMethod",
"span": {
"start": 89,
"end": 117,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 93,
"end": 101,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 94,
"end": 101,
"ctxt": 0
},
"value": "fooProp",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 89,
"end": 117,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 104,
"end": 117,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 106,
"end": 115,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 113,
"end": 114,
"ctxt": 0
},
"value": 1.0
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "EmptyStatement",
"span": {
"start": 117,
"end": 118,
"ctxt": 0
}
},
{
"type": "PrivateMethod",
"span": {
"start": 123,
"end": 154,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 127,
"end": 135,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 128,
"end": 135,
"ctxt": 0
},
"value": "fooProp",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 136,
"end": 149,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 136,
"end": 149,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 141,
"end": 149,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 143,
"end": 149,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 123,
"end": 154,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 151,
"end": 154,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "EmptyStatement",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
}
},
{
"type": "ClassProperty",
"span": {
"start": 160,
"end": 168,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 160,
"end": 163,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 166,
"end": 167,
"ctxt": 0
},
"value": 3.0
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 173,
"end": 181,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 173,
"end": 176,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 179,
"end": 180,
"ctxt": 0
},
"value": 3.0
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 225,
"end": 248,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 229,
"end": 247,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 229,
"end": 230,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 230,
"end": 239,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeOperator",
"span": {
"start": 232,
"end": 239,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 238,
"end": 239,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 238,
"end": 239,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 242,
"end": 247,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 255,
"end": 265,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 255,
"end": 264,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 259,
"end": 264,
"ctxt": 0
},
"value": "baz",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 273,
"end": 289,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 273,
"end": 288,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 273,
"end": 274,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 277,
"end": 288,
"ctxt": 0
},
"value": "#fooField",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 299,
"end": 316,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 299,
"end": 315,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 299,
"end": 300,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 303,
"end": 315,
"ctxt": 0
},
"value": "#fooMethod",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 326,
"end": 341,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 326,
"end": 340,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 326,
"end": 327,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 330,
"end": 340,
"ctxt": 0
},
"value": "#fooProp",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 352,
"end": 367,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 352,
"end": 366,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 352,
"end": 353,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 356,
"end": 366,
"ctxt": 0
},
"value": "fooField",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 377,
"end": 393,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 377,
"end": 392,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 377,
"end": 378,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 381,
"end": 392,
"ctxt": 0
},
"value": "fooMethod",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 403,
"end": 417,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 403,
"end": 416,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 403,
"end": 404,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 407,
"end": 416,
"ctxt": 0
},
"value": "fooProp",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
}
],
"interpreter": null
}