swc/crates/swc_ecma_parser/tests/tsc/jsDeclarationsFunctionClassesCjsExportAssignment.json
2022-04-05 12:46:35 +00:00

838 lines
21 KiB
JSON

{
"type": "Script",
"span": {
"start": 150,
"end": 1264,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 159,
"end": 164,
"ctxt": 0
},
"value": "Timer",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 165,
"end": 172,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 165,
"end": 172,
"ctxt": 0
},
"value": "timeout",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 150,
"end": 205,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 174,
"end": 205,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 180,
"end": 203,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 180,
"end": 202,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 180,
"end": 192,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 180,
"end": 184,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 185,
"end": 192,
"ctxt": 0
},
"value": "timeout",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 195,
"end": 202,
"ctxt": 0
},
"value": "timeout",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 206,
"end": 229,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 206,
"end": 228,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 206,
"end": 220,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 206,
"end": 212,
"ctxt": 0
},
"value": "module",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 213,
"end": 220,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 223,
"end": 228,
"ctxt": 0
},
"value": "Timer",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 369,
"end": 373,
"ctxt": 0
},
"value": "Hook",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 374,
"end": 380,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 374,
"end": 380,
"ctxt": 0
},
"value": "handle",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 360,
"end": 411,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 382,
"end": 411,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 388,
"end": 409,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 388,
"end": 408,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 388,
"end": 399,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 388,
"end": 392,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 393,
"end": 399,
"ctxt": 0
},
"value": "handle",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 402,
"end": 408,
"ctxt": 0
},
"value": "handle",
"optional": false
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 412,
"end": 434,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 412,
"end": 433,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 412,
"end": 426,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 412,
"end": 418,
"ctxt": 0
},
"value": "module",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 419,
"end": 426,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 429,
"end": 433,
"ctxt": 0
},
"value": "Hook",
"optional": false
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 902,
"end": 909,
"ctxt": 0
},
"value": "Context",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 910,
"end": 915,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 910,
"end": 915,
"ctxt": 0
},
"value": "input",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 893,
"end": 1036,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 917,
"end": 1036,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 923,
"end": 994,
"ctxt": 0
},
"test": {
"type": "UnaryExpression",
"span": {
"start": 927,
"end": 953,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "ParenthesisExpression",
"span": {
"start": 928,
"end": 953,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 929,
"end": 952,
"ctxt": 0
},
"operator": "instanceof",
"left": {
"type": "ThisExpression",
"span": {
"start": 929,
"end": 933,
"ctxt": 0
}
},
"right": {
"type": "Identifier",
"span": {
"start": 945,
"end": 952,
"ctxt": 0
},
"value": "Context",
"optional": false
}
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 955,
"end": 994,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 963,
"end": 988,
"ctxt": 0
},
"argument": {
"type": "NewExpression",
"span": {
"start": 970,
"end": 988,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 974,
"end": 981,
"ctxt": 0
},
"value": "Context",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 982,
"end": 987,
"ctxt": 0
},
"value": "input",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 999,
"end": 1034,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 999,
"end": 1033,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 999,
"end": 1009,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 999,
"end": 1003,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 1004,
"end": 1009,
"ctxt": 0
},
"value": "state",
"optional": false
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 1012,
"end": 1033,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 1012,
"end": 1026,
"ctxt": 0
},
"object": {
"type": "ThisExpression",
"span": {
"start": 1012,
"end": 1016,
"ctxt": 0
}
},
"property": {
"type": "Identifier",
"span": {
"start": 1017,
"end": 1026,
"ctxt": 0
},
"value": "construct",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 1027,
"end": 1032,
"ctxt": 0
},
"value": "input",
"optional": false
}
}
],
"typeArguments": null
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 1037,
"end": 1238,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 1037,
"end": 1238,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 1037,
"end": 1054,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1037,
"end": 1044,
"ctxt": 0
},
"value": "Context",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1045,
"end": 1054,
"ctxt": 0
},
"value": "prototype",
"optional": false
}
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 1057,
"end": 1238,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 1167,
"end": 1176,
"ctxt": 0
},
"value": "construct",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 1177,
"end": 1182,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 1177,
"end": 1182,
"ctxt": 0
},
"value": "input",
"optional": false,
"typeAnnotation": null
}
},
{
"type": "Parameter",
"span": {
"start": 1184,
"end": 1205,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "AssignmentPattern",
"span": {
"start": 1184,
"end": 1205,
"ctxt": 0
},
"left": {
"type": "Identifier",
"span": {
"start": 1184,
"end": 1190,
"ctxt": 0
},
"value": "handle",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ArrowFunctionExpression",
"span": {
"start": 1193,
"end": 1205,
"ctxt": 0
},
"params": [],
"body": {
"type": "UnaryExpression",
"span": {
"start": 1199,
"end": 1205,
"ctxt": 0
},
"operator": "void",
"argument": {
"type": "NumericLiteral",
"span": {
"start": 1204,
"end": 1205,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 1167,
"end": 1236,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1207,
"end": 1236,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 1217,
"end": 1230,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 1224,
"end": 1229,
"ctxt": 0
},
"value": "input",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
]
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 1239,
"end": 1264,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 1239,
"end": 1263,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 1239,
"end": 1253,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1239,
"end": 1245,
"ctxt": 0
},
"value": "module",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1246,
"end": 1253,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 1256,
"end": 1263,
"ctxt": 0
},
"value": "Context",
"optional": false
}
}
}
],
"interpreter": null
}