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

658 lines
16 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 86,
"end": 466,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 103,
"end": 115,
"ctxt": 0
},
"value": "getSpecifier",
"optional": false
},
"declare": true,
"params": [],
"decorators": [],
"span": {
"start": 86,
"end": 126,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 117,
"end": 125,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 119,
"end": 125,
"ctxt": 0
},
"kind": "string"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 127,
"end": 159,
"ctxt": 0
},
"kind": "var",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 139,
"end": 158,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 139,
"end": 149,
"ctxt": 0
},
"value": "whatToLoad",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 149,
"end": 158,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 151,
"end": 158,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 160,
"end": 192,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 174,
"end": 191,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 174,
"end": 183,
"ctxt": 0
},
"value": "directory",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 183,
"end": 191,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 185,
"end": 191,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 193,
"end": 226,
"ctxt": 0
},
"kind": "const",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 207,
"end": 225,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 207,
"end": 217,
"ctxt": 0
},
"value": "moduleFile",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 217,
"end": 225,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 219,
"end": 225,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 228,
"end": 251,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 228,
"end": 250,
"ctxt": 0
},
"callee": {
"type": "Import",
"span": {
"start": 228,
"end": 234,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 235,
"end": 249,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 235,
"end": 247,
"ctxt": 0
},
"value": "getSpecifier",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
],
"typeArguments": null
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 253,
"end": 300,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 257,
"end": 299,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 257,
"end": 259,
"ctxt": 0
},
"value": "p0",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 262,
"end": 299,
"ctxt": 0
},
"callee": {
"type": "Import",
"span": {
"start": 262,
"end": 268,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "TemplateLiteral",
"span": {
"start": 269,
"end": 298,
"ctxt": 0
},
"expressions": [
{
"type": "Identifier",
"span": {
"start": 272,
"end": 281,
"ctxt": 0
},
"value": "directory",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 286,
"end": 296,
"ctxt": 0
},
"value": "moduleFile",
"optional": false
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 270,
"end": 270,
"ctxt": 0
},
"tail": false,
"cooked": "",
"raw": ""
},
{
"type": "TemplateElement",
"span": {
"start": 282,
"end": 284,
"ctxt": 0
},
"tail": false,
"cooked": "\\",
"raw": "\\\\"
},
{
"type": "TemplateElement",
"span": {
"start": 297,
"end": 297,
"ctxt": 0
},
"tail": true,
"cooked": "",
"raw": ""
}
]
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 301,
"end": 333,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 305,
"end": 332,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 305,
"end": 307,
"ctxt": 0
},
"value": "p1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 310,
"end": 332,
"ctxt": 0
},
"callee": {
"type": "Import",
"span": {
"start": 310,
"end": 316,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 317,
"end": 331,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 317,
"end": 329,
"ctxt": 0
},
"value": "getSpecifier",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 334,
"end": 395,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 340,
"end": 395,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 340,
"end": 342,
"ctxt": 0
},
"value": "p2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 345,
"end": 395,
"ctxt": 0
},
"callee": {
"type": "Import",
"span": {
"start": 345,
"end": 351,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ConditionalExpression",
"span": {
"start": 352,
"end": 394,
"ctxt": 0
},
"test": {
"type": "Identifier",
"span": {
"start": 352,
"end": 362,
"ctxt": 0
},
"value": "whatToLoad",
"optional": false
},
"consequent": {
"type": "CallExpression",
"span": {
"start": 365,
"end": 379,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 365,
"end": 377,
"ctxt": 0
},
"value": "getSpecifier",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"alternate": {
"type": "StringLiteral",
"span": {
"start": 382,
"end": 394,
"ctxt": 0
},
"value": "defaulPath",
"raw": "\"defaulPath\""
}
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 406,
"end": 423,
"ctxt": 0
},
"value": "returnDynamicLoad",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 424,
"end": 436,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 424,
"end": 436,
"ctxt": 0
},
"value": "path",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 428,
"end": 436,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 430,
"end": 436,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 397,
"end": 466,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 438,
"end": 466,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 444,
"end": 464,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 451,
"end": 463,
"ctxt": 0
},
"callee": {
"type": "Import",
"span": {
"start": 451,
"end": 457,
"ctxt": 0
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 458,
"end": 462,
"ctxt": 0
},
"value": "path",
"optional": false
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}