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

973 lines
25 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 161,
"end": 1137,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 170,
"end": 172,
"ctxt": 0
},
"value": "C1",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 161,
"end": 353,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 175,
"end": 353,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 294,
"end": 351,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 294,
"end": 351,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 294,
"end": 303,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 294,
"end": 298,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 299,
"end": 303,
"ctxt": 0
},
"value": "prop",
"optional": false
}
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 316,
"end": 317,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 316,
"end": 317,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 319,
"end": 320,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 319,
"end": 320,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 306,
"end": 351,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 322,
"end": 351,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 332,
"end": 345,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 339,
"end": 344,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 339,
"end": 340,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 343,
"end": 344,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 446,
"end": 505,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 446,
"end": 505,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 446,
"end": 465,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 446,
"end": 458,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 446,
"end": 448,
"ctxt": 0
},
"value": "C1",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 449,
"end": 458,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 459,
"end": 465,
"ctxt": 0
},
"value": "method",
"optional": false
}
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 478,
"end": 479,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 478,
"end": 479,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 481,
"end": 482,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 481,
"end": 482,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 468,
"end": 505,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 484,
"end": 505,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 490,
"end": 503,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 497,
"end": 502,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 497,
"end": 498,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 501,
"end": 502,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 602,
"end": 655,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 602,
"end": 655,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 602,
"end": 615,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 602,
"end": 604,
"ctxt": 0
},
"value": "C1",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 605,
"end": 615,
"ctxt": 0
},
"value": "staticProp",
"optional": false
}
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 628,
"end": 629,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 628,
"end": 629,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 631,
"end": 632,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 631,
"end": 632,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 618,
"end": 655,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 634,
"end": 655,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 640,
"end": 653,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 647,
"end": 652,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 647,
"end": 648,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 651,
"end": 652,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 663,
"end": 665,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"declare": false,
"span": {
"start": 657,
"end": 833,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 788,
"end": 831,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 788,
"end": 795,
"ctxt": 0
},
"value": "method1",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 796,
"end": 797,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 796,
"end": 797,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 799,
"end": 800,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 799,
"end": 800,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 788,
"end": 831,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 802,
"end": 831,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 812,
"end": 825,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 819,
"end": 824,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 819,
"end": 820,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 823,
"end": 824,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ExpressionStatement",
"span": {
"start": 927,
"end": 987,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 927,
"end": 987,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 927,
"end": 947,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 927,
"end": 939,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 927,
"end": 929,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 930,
"end": 939,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 940,
"end": 947,
"ctxt": 0
},
"value": "method2",
"optional": false
}
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 960,
"end": 961,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 960,
"end": 961,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 963,
"end": 964,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 963,
"end": 964,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 950,
"end": 987,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 966,
"end": 987,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 972,
"end": 985,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 979,
"end": 984,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 979,
"end": 980,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 983,
"end": 984,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 1084,
"end": 1137,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 1084,
"end": 1137,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 1084,
"end": 1097,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1084,
"end": 1086,
"ctxt": 0
},
"value": "C2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1087,
"end": 1097,
"ctxt": 0
},
"value": "staticProp",
"optional": false
}
},
"right": {
"type": "FunctionExpression",
"identifier": null,
"params": [
{
"type": "Parameter",
"span": {
"start": 1110,
"end": 1111,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1110,
"end": 1111,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 1113,
"end": 1114,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1113,
"end": 1114,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 1100,
"end": 1137,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1116,
"end": 1137,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 1122,
"end": 1135,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 1129,
"end": 1134,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 1129,
"end": 1130,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 1133,
"end": 1134,
"ctxt": 0
},
"value": "y",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
}
}
],
"interpreter": null
}