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

896 lines
20 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 1,
"end": 355,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 7,
"end": 8,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 1,
"end": 271,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 15,
"end": 35,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 25,
"end": 26,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 26,
"end": 34,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 28,
"end": 34,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": "protected",
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 40,
"end": 74,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 54,
"end": 55,
"ctxt": 0
},
"value": "y",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 40,
"end": 74,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 58,
"end": 74,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 60,
"end": 72,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 67,
"end": 71,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": "protected",
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 79,
"end": 101,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 93,
"end": 94,
"ctxt": 0
},
"value": "y",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 95,
"end": 96,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 95,
"end": 96,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 79,
"end": 101,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 98,
"end": 101,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": "protected",
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 106,
"end": 125,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 116,
"end": 119,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 106,
"end": 125,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 122,
"end": 125,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": "protected",
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassProperty",
"span": {
"start": 131,
"end": 158,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "a",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 149,
"end": 157,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 151,
"end": 157,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": true,
"decorators": [],
"accessibility": "protected",
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 163,
"end": 204,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 184,
"end": 185,
"ctxt": 0
},
"value": "b",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 163,
"end": 204,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 188,
"end": 204,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 190,
"end": 202,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 197,
"end": 201,
"ctxt": 0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": true,
"accessibility": "protected",
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 209,
"end": 238,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 230,
"end": 231,
"ctxt": 0
},
"value": "b",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 209,
"end": 238,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 235,
"end": 238,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": true,
"accessibility": "protected",
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 243,
"end": 269,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 260,
"end": 263,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 243,
"end": 269,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 266,
"end": 269,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": true,
"accessibility": "protected",
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 273,
"end": 282,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 277,
"end": 281,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 277,
"end": 278,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 278,
"end": 281,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 280,
"end": 281,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 280,
"end": 281,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 297,
"end": 301,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 297,
"end": 300,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 297,
"end": 298,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 299,
"end": 300,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 302,
"end": 306,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 302,
"end": 305,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 302,
"end": 303,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 304,
"end": 305,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 307,
"end": 315,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 307,
"end": 314,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 307,
"end": 310,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 307,
"end": 308,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": "y",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 313,
"end": 314,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 316,
"end": 324,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 316,
"end": 323,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 316,
"end": 321,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 316,
"end": 317,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 318,
"end": 321,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 326,
"end": 330,
"ctxt": 0
},
"expression": {
"type": "MemberExpression",
"span": {
"start": 326,
"end": 329,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 326,
"end": 327,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 331,
"end": 337,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 331,
"end": 336,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 331,
"end": 334,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 333,
"end": 334,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 338,
"end": 346,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 338,
"end": 345,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 338,
"end": 341,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 338,
"end": 339,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 340,
"end": 341,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 344,
"end": 345,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 347,
"end": 355,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 347,
"end": 354,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 347,
"end": 352,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 347,
"end": 348,
"ctxt": 0
},
"value": "C",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 349,
"end": 352,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
],
"interpreter": null
}