swc/crates/swc_ecma_parser/tests/tsc/jsDeclarationsGetterSetter.json
2022-03-22 07:54:08 +00:00

1003 lines
26 KiB
JSON

{
"type": "Module",
"span": {
"start": 115,
"end": 735,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 115,
"end": 172,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 128,
"end": 129,
"ctxt": 0
},
"value": "A",
"optional": false
},
"declare": false,
"span": {
"start": 122,
"end": 172,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 136,
"end": 170,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 140,
"end": 141,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 136,
"end": 170,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 144,
"end": 170,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 154,
"end": 164,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 161,
"end": 163,
"ctxt": 0
},
"value": 12.0
}
}
]
},
"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": 174,
"end": 260,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 187,
"end": 188,
"ctxt": 0
},
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 181,
"end": 260,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 239,
"end": 258,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 243,
"end": 244,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 245,
"end": 249,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 245,
"end": 249,
"ctxt": 0
},
"value": "_arg",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 239,
"end": 258,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 251,
"end": 258,
"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": 262,
"end": 343,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 275,
"end": 276,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 269,
"end": 343,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 283,
"end": 317,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 283,
"end": 317,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 291,
"end": 317,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 301,
"end": 311,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 308,
"end": 310,
"ctxt": 0
},
"value": 12.0
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "getter",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
},
{
"type": "ClassMethod",
"span": {
"start": 322,
"end": 341,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 326,
"end": 327,
"ctxt": 0
},
"value": "x",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 328,
"end": 332,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 328,
"end": 332,
"ctxt": 0
},
"value": "_arg",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 322,
"end": 341,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 334,
"end": 341,
"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": 345,
"end": 362,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 358,
"end": 359,
"ctxt": 0
},
"value": "D",
"optional": false
},
"declare": false,
"span": {
"start": 352,
"end": 362,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 363,
"end": 445,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 363,
"end": 444,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 363,
"end": 384,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 363,
"end": 369,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 370,
"end": 384,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 385,
"end": 396,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 385,
"end": 386,
"ctxt": 0
},
"value": "D",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 387,
"end": 396,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 398,
"end": 401,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 403,
"end": 443,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 409,
"end": 412,
"ctxt": 0
},
"value": "get",
"optional": false
},
"params": [],
"decorators": [],
"span": {
"start": 409,
"end": 441,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 415,
"end": 441,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 425,
"end": 435,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 432,
"end": 434,
"ctxt": 0
},
"value": 12.0
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 447,
"end": 464,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 460,
"end": 461,
"ctxt": 0
},
"value": "E",
"optional": false
},
"declare": false,
"span": {
"start": 454,
"end": 464,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 465,
"end": 571,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 465,
"end": 570,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 465,
"end": 486,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 465,
"end": 471,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 472,
"end": 486,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 487,
"end": 498,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 487,
"end": 488,
"ctxt": 0
},
"value": "E",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 489,
"end": 498,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 500,
"end": 503,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 505,
"end": 569,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 555,
"end": 558,
"ctxt": 0
},
"value": "set",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 559,
"end": 563,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 559,
"end": 563,
"ctxt": 0
},
"value": "_arg",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 555,
"end": 567,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 565,
"end": 567,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
],
"typeArguments": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 573,
"end": 590,
"ctxt": 0
},
"declaration": {
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 586,
"end": 587,
"ctxt": 0
},
"value": "F",
"optional": false
},
"declare": false,
"span": {
"start": 580,
"end": 590,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 591,
"end": 735,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 591,
"end": 734,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 591,
"end": 612,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 591,
"end": 597,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 598,
"end": 612,
"ctxt": 0
},
"value": "defineProperty",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 613,
"end": 624,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 613,
"end": 614,
"ctxt": 0
},
"value": "F",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 615,
"end": 624,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 626,
"end": 629,
"ctxt": 0
},
"value": "x",
"raw": "\"x\""
}
},
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 631,
"end": 733,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 637,
"end": 640,
"ctxt": 0
},
"value": "get",
"optional": false
},
"params": [],
"decorators": [],
"span": {
"start": 637,
"end": 669,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 643,
"end": 669,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 653,
"end": 663,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 660,
"end": 662,
"ctxt": 0
},
"value": 12.0
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 719,
"end": 722,
"ctxt": 0
},
"value": "set",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 723,
"end": 727,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 723,
"end": 727,
"ctxt": 0
},
"value": "_arg",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 719,
"end": 731,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 729,
"end": 731,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}