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

920 lines
24 KiB
JSON

{
"type": "Script",
"span": {
"start": 16,
"end": 533,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 16,
"end": 533,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 30,
"end": 44,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 30,
"end": 35,
"ctxt": 0
},
"value": "_name",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 35,
"end": 43,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 37,
"end": 43,
"ctxt": 0
},
"kind": "string"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false,
"readonly": false,
"declare": false,
"definite": false
},
{
"type": "ClassMethod",
"span": {
"start": 49,
"end": 102,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 53,
"end": 57,
"ctxt": 0
},
"value": "name",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 49,
"end": 102,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 68,
"end": 102,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 78,
"end": 96,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 85,
"end": 95,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 85,
"end": 89,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 90,
"end": 95,
"ctxt": 0
},
"value": "_name",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 59,
"end": 67,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 61,
"end": 67,
"ctxt": 0
},
"kind": "string"
}
}
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 107,
"end": 163,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 118,
"end": 123,
"ctxt": 0
},
"value": "name2",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 107,
"end": 163,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 134,
"end": 163,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 144,
"end": 157,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 151,
"end": 156,
"ctxt": 0
},
"value": "BYE",
"raw": "\"BYE\""
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 125,
"end": 133,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 127,
"end": 133,
"ctxt": 0
},
"kind": "string"
}
}
},
"kind": "getter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 168,
"end": 224,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 179,
"end": 195,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 180,
"end": 194,
"ctxt": 0
},
"value": "computedname",
"raw": "\"computedname\""
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 168,
"end": 224,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 198,
"end": 224,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 208,
"end": 218,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 215,
"end": 217,
"ctxt": 0
},
"value": "",
"raw": "\"\""
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 229,
"end": 279,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 233,
"end": 250,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 234,
"end": 249,
"ctxt": 0
},
"value": "computedname1",
"raw": "\"computedname1\""
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 229,
"end": 279,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 253,
"end": 279,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 263,
"end": 273,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 270,
"end": 272,
"ctxt": 0
},
"value": "",
"raw": "\"\""
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 284,
"end": 334,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 288,
"end": 305,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 289,
"end": 304,
"ctxt": 0
},
"value": "computedname2",
"raw": "\"computedname2\""
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 284,
"end": 334,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 308,
"end": 334,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 318,
"end": 328,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 325,
"end": 327,
"ctxt": 0
},
"value": "",
"raw": "\"\""
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 340,
"end": 377,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 344,
"end": 361,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 345,
"end": 360,
"ctxt": 0
},
"value": "computedname3",
"raw": "\"computedname3\""
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 362,
"end": 368,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 362,
"end": 368,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 363,
"end": 368,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 365,
"end": 368,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 340,
"end": 377,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 370,
"end": 377,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 382,
"end": 422,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 386,
"end": 403,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 387,
"end": 402,
"ctxt": 0
},
"value": "computedname4",
"raw": "\"computedname4\""
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 404,
"end": 413,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 404,
"end": 413,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 405,
"end": 413,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 407,
"end": 413,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 382,
"end": 422,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 415,
"end": 422,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 428,
"end": 450,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 432,
"end": 435,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 436,
"end": 445,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 436,
"end": 445,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 437,
"end": 445,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 439,
"end": 445,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 428,
"end": 450,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 447,
"end": 450,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 455,
"end": 484,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 466,
"end": 469,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 470,
"end": 479,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 470,
"end": 479,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 471,
"end": 479,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 473,
"end": 479,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 455,
"end": 484,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 481,
"end": 484,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 489,
"end": 531,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 500,
"end": 516,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 501,
"end": 515,
"ctxt": 0
},
"value": "computedname",
"raw": "\"computedname\""
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 517,
"end": 526,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 517,
"end": 526,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 518,
"end": 526,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 520,
"end": 526,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 489,
"end": 531,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 528,
"end": 531,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
],
"interpreter": null
}