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

546 lines
14 KiB
JSON

{
"type": "Module",
"span": {
"start": 60,
"end": 387,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 60,
"end": 99,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 76,
"end": 79,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 67,
"end": 99,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 82,
"end": 99,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 84,
"end": 97,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 91,
"end": 96,
"ctxt": 0
},
"value": "foo",
"raw": "\"foo\""
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 120,
"end": 165,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 136,
"end": 142,
"ctxt": 0
},
"value": "backup",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 127,
"end": 165,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 145,
"end": 165,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 147,
"end": 163,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 154,
"end": 162,
"ctxt": 0
},
"value": "backup",
"raw": "\"backup\""
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 201,
"end": 208,
"ctxt": 0
},
"value": "compute",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 209,
"end": 230,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 209,
"end": 230,
"ctxt": 0
},
"value": "promise",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 216,
"end": 230,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 218,
"end": 230,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 218,
"end": 225,
"ctxt": 0
},
"value": "Promise",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 225,
"end": 230,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 226,
"end": 229,
"ctxt": 0
},
"kind": "any"
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 186,
"end": 362,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 232,
"end": 362,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 238,
"end": 260,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 242,
"end": 259,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 242,
"end": 243,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "AwaitExpression",
"span": {
"start": 246,
"end": 259,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 252,
"end": 259,
"ctxt": 0
},
"value": "promise",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 265,
"end": 340,
"ctxt": 0
},
"test": {
"type": "UnaryExpression",
"span": {
"start": 269,
"end": 271,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "Identifier",
"span": {
"start": 270,
"end": 271,
"ctxt": 0
},
"value": "j",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 273,
"end": 340,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 283,
"end": 307,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 283,
"end": 306,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 283,
"end": 284,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "AwaitExpression",
"span": {
"start": 287,
"end": 306,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 293,
"end": 306,
"ctxt": 0
},
"callee": {
"type": "Import",
"span": {
"start": 293,
"end": 299,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 300,
"end": 305,
"ctxt": 0
},
"value": "./1",
"raw": "\"./1\""
}
}
],
"typeArguments": null
}
}
}
},
{
"type": "ReturnStatement",
"span": {
"start": 316,
"end": 334,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 323,
"end": 333,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 323,
"end": 331,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 323,
"end": 324,
"ctxt": 0
},
"value": "j",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 325,
"end": 331,
"ctxt": 0
},
"value": "backup",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"alternate": null
},
{
"type": "ReturnStatement",
"span": {
"start": 345,
"end": 360,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 352,
"end": 359,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 352,
"end": 357,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 352,
"end": 353,
"ctxt": 0
},
"value": "j",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 354,
"end": 357,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"generator": false,
"async": true,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 364,
"end": 387,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 364,
"end": 386,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 364,
"end": 371,
"ctxt": 0
},
"value": "compute",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 372,
"end": 385,
"ctxt": 0
},
"callee": {
"type": "Import",
"span": {
"start": 372,
"end": 378,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 379,
"end": 384,
"ctxt": 0
},
"value": "./0",
"raw": "\"./0\""
}
}
],
"typeArguments": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}