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

499 lines
12 KiB
JSON
Raw Normal View History

{
"type": "Module",
"span": {
"start": 45,
"end": 401,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 45,
"end": 65,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 52,
"end": 65,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 56,
"end": 64,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 59,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 62,
"end": 64,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
},
"definite": false
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 100,
"end": 134,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 116,
"end": 117,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 107,
"end": 134,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 119,
"end": 134,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 122,
"end": 132,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 129,
"end": 131,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 164,
"end": 206,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 171,
"end": 206,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 178,
"end": 180,
"ctxt": 0
},
"value": "M2",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 181,
"end": 206,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 184,
"end": 204,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 191,
"end": 204,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 195,
"end": 203,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 195,
"end": 196,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BooleanLiteral",
"span": {
"start": 199,
"end": 203,
"ctxt": 0
},
"value": true
},
"definite": false
}
]
}
}
]
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 236,
"end": 270,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 243,
"end": 247,
"ctxt": 0
},
"value": "foo0",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 250,
"end": 269,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 258,
"end": 268,
"ctxt": 0
},
"value": "../foo_0",
"raw": "'../foo_0'"
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 271,
"end": 309,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 278,
"end": 282,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 285,
"end": 308,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 293,
"end": 307,
"ctxt": 0
},
"value": "./test/foo_1",
"raw": "'./test/foo_1'"
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 310,
"end": 353,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 317,
"end": 321,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 324,
"end": 352,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 332,
"end": 351,
"ctxt": 0
},
"value": "./.././test/foo_2",
"raw": "'./.././test/foo_2'"
}
}
},
{
"type": "IfStatement",
"span": {
"start": 355,
"end": 401,
"ctxt": 0
},
"test": {
"type": "MemberExpression",
"span": {
"start": 358,
"end": 367,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 358,
"end": 365,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 358,
"end": 362,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 363,
"end": 365,
"ctxt": 0
},
"value": "M2",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 366,
"end": 367,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 368,
"end": 401,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 371,
"end": 399,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 375,
"end": 398,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 375,
"end": 376,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 379,
"end": 398,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "MemberExpression",
"span": {
"start": 379,
"end": 387,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 379,
"end": 383,
"ctxt": 0
},
"value": "foo0",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 384,
"end": 387,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 390,
"end": 398,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 390,
"end": 396,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 390,
"end": 394,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 395,
"end": 396,
"ctxt": 0
},
"value": "f",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
"definite": false
}
]
}
]
},
"alternate": null
}
],
"interpreter": null
}