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

960 lines
25 KiB
JSON

{
"type": "Script",
"span": {
"start": 15,
"end": 532,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 15,
"end": 532,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassProperty",
"span": {
"start": 29,
"end": 43,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 29,
"end": 34,
"ctxt": 0
},
"value": "_name",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 34,
"end": 42,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 36,
"end": 42,
"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": 48,
"end": 101,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 52,
"end": 56,
"ctxt": 0
},
"value": "name",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 48,
"end": 101,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 67,
"end": 101,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 77,
"end": 95,
"ctxt": 0
},
"argument": {
"type": "MemberExpression",
"span": {
"start": 84,
"end": 94,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 84,
"end": 88,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 89,
"end": 94,
"ctxt": 0
},
"value": "_name",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 58,
"end": 66,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 60,
"end": 66,
"ctxt": 0
},
"kind": "string"
}
}
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 106,
"end": 162,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 117,
"end": 122,
"ctxt": 0
},
"value": "name2",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 106,
"end": 162,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 133,
"end": 162,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 143,
"end": 156,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 150,
"end": 155,
"ctxt": 0
},
"value": "BYE",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 124,
"end": 132,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 126,
"end": 132,
"ctxt": 0
},
"kind": "string"
}
}
},
"kind": "getter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 167,
"end": 223,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 178,
"end": 194,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 179,
"end": 193,
"ctxt": 0
},
"value": "computedname",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 167,
"end": 223,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 197,
"end": 223,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 207,
"end": 217,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 214,
"end": 216,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": true,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 228,
"end": 278,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 232,
"end": 249,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 233,
"end": 248,
"ctxt": 0
},
"value": "computedname1",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 228,
"end": 278,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 252,
"end": 278,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 262,
"end": 272,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 269,
"end": 271,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 283,
"end": 333,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 287,
"end": 304,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 288,
"end": 303,
"ctxt": 0
},
"value": "computedname2",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 283,
"end": 333,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 307,
"end": 333,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 317,
"end": 327,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 324,
"end": 326,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 339,
"end": 376,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 343,
"end": 360,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 344,
"end": 359,
"ctxt": 0
},
"value": "computedname3",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 361,
"end": 367,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 361,
"end": 367,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 362,
"end": 367,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 364,
"end": 367,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 339,
"end": 376,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 369,
"end": 376,
"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": 381,
"end": 421,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 385,
"end": 402,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 386,
"end": 401,
"ctxt": 0
},
"value": "computedname4",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 403,
"end": 412,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 403,
"end": 412,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 404,
"end": 412,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 406,
"end": 412,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 381,
"end": 421,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 414,
"end": 421,
"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": 427,
"end": 449,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 431,
"end": 434,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 435,
"end": 444,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 435,
"end": 444,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 436,
"end": 444,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 438,
"end": 444,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 427,
"end": 449,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 446,
"end": 449,
"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": 454,
"end": 483,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 465,
"end": 468,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 469,
"end": 478,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 469,
"end": 478,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 470,
"end": 478,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 472,
"end": 478,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 454,
"end": 483,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 480,
"end": 483,
"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": 488,
"end": 530,
"ctxt": 0
},
"key": {
"type": "Computed",
"span": {
"start": 499,
"end": 515,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 500,
"end": 514,
"ctxt": 0
},
"value": "computedname",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 516,
"end": 525,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 516,
"end": 525,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 517,
"end": 525,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 519,
"end": 525,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 488,
"end": 530,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 527,
"end": 530,
"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
}