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

744 lines
17 KiB
JSON

{
"type": "Script",
"span": {
"start": 35,
"end": 418,
"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": 184,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "PrivateProperty",
"span": {
"start": 49,
"end": 63,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 49,
"end": 58,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 50,
"end": 58,
"ctxt": 0
},
"value": "fooField",
"optional": false
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 61,
"end": 62,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isOptional": false,
"isOverride": false,
"readonly": false,
"definite": false
},
{
"type": "PrivateMethod",
"span": {
"start": 68,
"end": 84,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 68,
"end": 78,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 69,
"end": 78,
"ctxt": 0
},
"value": "fooMethod",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 68,
"end": 84,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 81,
"end": 84,
"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": 84,
"end": 85,
"ctxt": 0
}
},
{
"type": "PrivateMethod",
"span": {
"start": 90,
"end": 118,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 94,
"end": 102,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 95,
"end": 102,
"ctxt": 0
},
"value": "fooProp",
"optional": false
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 90,
"end": 118,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 105,
"end": 118,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 107,
"end": 116,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 114,
"end": 115,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "EmptyStatement",
"span": {
"start": 118,
"end": 119,
"ctxt": 0
}
},
{
"type": "PrivateMethod",
"span": {
"start": 124,
"end": 155,
"ctxt": 0
},
"key": {
"type": "PrivateName",
"span": {
"start": 128,
"end": 136,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 129,
"end": 136,
"ctxt": 0
},
"value": "fooProp",
"optional": false
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 137,
"end": 150,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 137,
"end": 150,
"ctxt": 0
},
"value": "value",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 142,
"end": 150,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 144,
"end": 150,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 124,
"end": 155,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 152,
"end": 155,
"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": 155,
"end": 156,
"ctxt": 0
}
},
{
"type": "ClassProperty",
"span": {
"start": 161,
"end": 169,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 161,
"end": 164,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 167,
"end": 168,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
},
"typeAnnotation": null,
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassProperty",
"span": {
"start": 174,
"end": 182,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 174,
"end": 177,
"ctxt": 0
},
"value": "baz",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
},
"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": 226,
"end": 249,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 230,
"end": 248,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 231,
"end": 240,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeOperator",
"span": {
"start": 233,
"end": 240,
"ctxt": 0
},
"op": "keyof",
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"value": "A",
"optional": false
},
"typeParams": null
}
}
}
},
"init": {
"type": "StringLiteral",
"span": {
"start": 243,
"end": 248,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 256,
"end": 266,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 256,
"end": 265,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 256,
"end": 257,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 260,
"end": 265,
"ctxt": 0
},
"value": "baz",
"raw": "\"baz\""
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 274,
"end": 290,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 274,
"end": 289,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 274,
"end": 275,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 278,
"end": 289,
"ctxt": 0
},
"value": "#fooField",
"raw": "\"#fooField\""
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 300,
"end": 317,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 300,
"end": 316,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 300,
"end": 301,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 304,
"end": 316,
"ctxt": 0
},
"value": "#fooMethod",
"raw": "\"#fooMethod\""
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 327,
"end": 342,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 327,
"end": 341,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 327,
"end": 328,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 331,
"end": 341,
"ctxt": 0
},
"value": "#fooProp",
"raw": "\"#fooProp\""
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 353,
"end": 368,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 353,
"end": 367,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 357,
"end": 367,
"ctxt": 0
},
"value": "fooField",
"raw": "\"fooField\""
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 378,
"end": 394,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 378,
"end": 393,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 378,
"end": 379,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 382,
"end": 393,
"ctxt": 0
},
"value": "fooMethod",
"raw": "\"fooMethod\""
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 404,
"end": 418,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 404,
"end": 417,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 404,
"end": 405,
"ctxt": 0
},
"value": "k",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 408,
"end": 417,
"ctxt": 0
},
"value": "fooProp",
"raw": "\"fooProp\""
}
}
}
],
"interpreter": null
}