swc/crates/swc_ecma_parser/tests/tsc/importCallExpressionInCJS2.json
2022-02-04 17:08:38 +09:00

562 lines
15 KiB
JSON

{
"type": "Module",
"span": {
"start": 59,
"end": 386,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 59,
"end": 98,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 75,
"end": 78,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 66,
"end": 98,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 81,
"end": 98,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 83,
"end": 96,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 90,
"end": 95,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 119,
"end": 164,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 135,
"end": 141,
"ctxt": 0
},
"value": "backup",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 126,
"end": 164,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 144,
"end": 164,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 146,
"end": 162,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 153,
"end": 161,
"ctxt": 0
},
"value": "backup",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 200,
"end": 207,
"ctxt": 0
},
"value": "compute",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 208,
"end": 229,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 208,
"end": 229,
"ctxt": 0
},
"value": "promise",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 215,
"end": 229,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 217,
"end": 229,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 217,
"end": 224,
"ctxt": 0
},
"value": "Promise",
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 224,
"end": 229,
"ctxt": 0
},
"params": [
{
"type": "TsKeywordType",
"span": {
"start": 225,
"end": 228,
"ctxt": 0
},
"kind": "any"
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 185,
"end": 361,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 231,
"end": 361,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 237,
"end": 259,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 241,
"end": 258,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 241,
"end": 242,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "AwaitExpression",
"span": {
"start": 245,
"end": 258,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 251,
"end": 258,
"ctxt": 0
},
"value": "promise",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 264,
"end": 339,
"ctxt": 0
},
"test": {
"type": "UnaryExpression",
"span": {
"start": 268,
"end": 270,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "Identifier",
"span": {
"start": 269,
"end": 270,
"ctxt": 0
},
"value": "j",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 272,
"end": 339,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 282,
"end": 306,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 282,
"end": 305,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 282,
"end": 283,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "AwaitExpression",
"span": {
"start": 286,
"end": 305,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 292,
"end": 305,
"ctxt": 0
},
"callee": {
"type": "Import",
"span": {
"start": 292,
"end": 298,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 299,
"end": 304,
"ctxt": 0
},
"value": "./1",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
}
}
}
},
{
"type": "ReturnStatement",
"span": {
"start": 315,
"end": 333,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 322,
"end": 332,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 322,
"end": 330,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 322,
"end": 323,
"ctxt": 0
},
"value": "j",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 324,
"end": 330,
"ctxt": 0
},
"value": "backup",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"alternate": null
},
{
"type": "ReturnStatement",
"span": {
"start": 344,
"end": 359,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 351,
"end": 358,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 351,
"end": 356,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 351,
"end": 352,
"ctxt": 0
},
"value": "j",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 353,
"end": 356,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
}
]
},
"generator": false,
"async": true,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 363,
"end": 386,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 363,
"end": 385,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 363,
"end": 370,
"ctxt": 0
},
"value": "compute",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 371,
"end": 384,
"ctxt": 0
},
"callee": {
"type": "Import",
"span": {
"start": 371,
"end": 377,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 378,
"end": 383,
"ctxt": 0
},
"value": "./0",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}