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

838 lines
21 KiB
JSON

{
"type": "Script",
"span": {
"start": 151,
"end": 1265,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 160,
"end": 165,
"ctxt": 0
},
"value": "Timer",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 166,
"end": 173,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 166,
"end": 173,
"ctxt": 0
},
"value": "timeout",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 151,
"end": 206,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 175,
"end": 206,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 181,
"end": 204,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 181,
"end": 203,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 181,
"end": 193,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 181,
"end": 185,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 186,
"end": 193,
"ctxt": 0
},
"value": "timeout",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 196,
"end": 203,
"ctxt": 0
},
"value": "timeout",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 207,
"end": 230,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 207,
"end": 229,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 207,
"end": 221,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 207,
"end": 213,
"ctxt": 0
},
"value": "module",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 214,
"end": 221,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 224,
"end": 229,
"ctxt": 0
},
"value": "Timer",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 370,
"end": 374,
"ctxt": 0
},
"value": "Hook",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 375,
"end": 381,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 375,
"end": 381,
"ctxt": 0
},
"value": "handle",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 361,
"end": 412,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 383,
"end": 412,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 389,
"end": 410,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 389,
"end": 409,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 389,
"end": 400,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 389,
"end": 393,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 394,
"end": 400,
"ctxt": 0
},
"value": "handle",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 403,
"end": 409,
"ctxt": 0
},
"value": "handle",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 413,
"end": 435,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 413,
"end": 434,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 413,
"end": 427,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 413,
"end": 419,
"ctxt": 0
},
"value": "module",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 420,
"end": 427,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 430,
"end": 434,
"ctxt": 0
},
"value": "Hook",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 903,
"end": 910,
"ctxt": 0
},
"value": "Context",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 911,
"end": 916,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 911,
"end": 916,
"ctxt": 0
},
"value": "input",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 894,
"end": 1037,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 918,
"end": 1037,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 924,
"end": 995,
"ctxt": 0
},
"test": {
"type": "UnaryExpression",
"span": {
"start": 928,
"end": 954,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 929,
"end": 954,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 930,
"end": 953,
"ctxt": 0
},
"operator": "instanceof",
"left": {
"type": "ThisExpression",
"span": {
"start": 930,
"end": 934,
"ctxt": 0
}
},
"right": {
"type": "Identifier",
"span": {
"start": 946,
"end": 953,
"ctxt": 0
},
"value": "Context",
"optional": false
}
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 956,
"end": 995,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 964,
"end": 989,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 971,
"end": 989,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 975,
"end": 982,
"ctxt": 0
},
"value": "Context",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 983,
"end": 988,
"ctxt": 0
},
"value": "input",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 1000,
"end": 1035,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 1000,
"end": 1034,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 1000,
"end": 1010,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 1000,
"end": 1004,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 1005,
"end": 1010,
"ctxt": 0
},
"value": "state",
"optional": false
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 1013,
"end": 1034,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 1013,
"end": 1027,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 1013,
"end": 1017,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 1018,
"end": 1027,
"ctxt": 0
},
"value": "construct",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 1028,
"end": 1033,
"ctxt": 0
},
"value": "input",
"optional": false
}
}
],
"typeArguments": null
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 1038,
"end": 1239,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 1038,
"end": 1239,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 1038,
"end": 1055,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1038,
"end": 1045,
"ctxt": 0
},
"value": "Context",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1046,
"end": 1055,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 1058,
"end": 1239,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 1168,
"end": 1177,
"ctxt": 0
},
"value": "construct",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 1178,
"end": 1183,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1178,
"end": 1183,
"ctxt": 0
},
"value": "input",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 1185,
"end": 1206,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 1185,
"end": 1206,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 1185,
"end": 1191,
"ctxt": 0
},
"value": "handle",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 1194,
"end": 1206,
"ctxt": 0
},
"params": [],
"body": {
"type": "UnaryExpression",
"span": {
"start": 1200,
"end": 1206,
"ctxt": 0
},
"operator": "void",
"argument": {
"type": "NumericLiteral",
"span": {
"start": 1205,
"end": 1206,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 1168,
"end": 1237,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1208,
"end": 1237,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 1218,
"end": 1231,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 1225,
"end": 1230,
"ctxt": 0
},
"value": "input",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 1240,
"end": 1265,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 1240,
"end": 1264,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 1240,
"end": 1254,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1240,
"end": 1246,
"ctxt": 0
},
"value": "module",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1247,
"end": 1254,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 1257,
"end": 1264,
"ctxt": 0
},
"value": "Context",
"optional": false
}
}
}
],
"interpreter": null
}