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

1007 lines
26 KiB
JSON

{
"type": "Module",
"span": {
"start": 116,
"end": 736,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 116,
"end": 173,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 129,
"end": 130,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 123,
"end": 173,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 137,
"end": 171,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 141,
"end": 142,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 137,
"end": 171,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 145,
"end": 171,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 155,
"end": 165,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 162,
"end": 164,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 175,
"end": 261,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 182,
"end": 261,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 240,
"end": 259,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 244,
"end": 245,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 246,
"end": 250,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 246,
"end": 250,
"ctxt": 0
},
"value": "_arg",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 240,
"end": 259,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 252,
"end": 259,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 263,
"end": 344,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 276,
"end": 277,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 270,
"end": 344,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 284,
"end": 318,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 288,
"end": 289,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 284,
"end": 318,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 292,
"end": 318,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 302,
"end": 312,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 309,
"end": 311,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 323,
"end": 342,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 327,
"end": 328,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 329,
"end": 333,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 329,
"end": 333,
"ctxt": 0
},
"value": "_arg",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 323,
"end": 342,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 335,
"end": 342,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "setter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 346,
"end": 363,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 359,
"end": 360,
"ctxt": 0
},
"value": "D",
"optional": false
},
"declare": false,
"span": {
"start": 353,
"end": 363,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 364,
"end": 446,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 364,
"end": 445,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 364,
"end": 385,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 364,
"end": 370,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 371,
"end": 385,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 386,
"end": 397,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 386,
"end": 387,
"ctxt": 0
},
"value": "D",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 388,
"end": 397,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 399,
"end": 402,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 404,
"end": 444,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 410,
"end": 413,
"ctxt": 0
},
"value": "get",
"optional": false
},
"params": [],
"decorators": [],
"span": {
"start": 410,
"end": 442,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 416,
"end": 442,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 426,
"end": 436,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 433,
"end": 435,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 448,
"end": 465,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 461,
"end": 462,
"ctxt": 0
},
"value": "E",
"optional": false
},
"declare": false,
"span": {
"start": 455,
"end": 465,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 466,
"end": 572,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 466,
"end": 571,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 466,
"end": 487,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 466,
"end": 472,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 473,
"end": 487,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 488,
"end": 499,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 488,
"end": 489,
"ctxt": 0
},
"value": "E",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 490,
"end": 499,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 501,
"end": 504,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 506,
"end": 570,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 556,
"end": 559,
"ctxt": 0
},
"value": "set",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 560,
"end": 564,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 560,
"end": 564,
"ctxt": 0
},
"value": "_arg",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 556,
"end": 568,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 566,
"end": 568,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 574,
"end": 591,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 587,
"end": 588,
"ctxt": 0
},
"value": "F",
"optional": false
},
"declare": false,
"span": {
"start": 581,
"end": 591,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 592,
"end": 736,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 592,
"end": 735,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 592,
"end": 613,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 592,
"end": 598,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 599,
"end": 613,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 614,
"end": 625,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 614,
"end": 615,
"ctxt": 0
},
"value": "F",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 616,
"end": 625,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 627,
"end": 630,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 632,
"end": 734,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 638,
"end": 641,
"ctxt": 0
},
"value": "get",
"optional": false
},
"params": [],
"decorators": [],
"span": {
"start": 638,
"end": 670,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 644,
"end": 670,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 654,
"end": 664,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 661,
"end": 663,
"ctxt": 0
},
"value": 12.0,
"raw": "12"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 720,
"end": 723,
"ctxt": 0
},
"value": "set",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 724,
"end": 728,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 724,
"end": 728,
"ctxt": 0
},
"value": "_arg",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 720,
"end": 732,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 730,
"end": 732,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}