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

499 lines
12 KiB
JSON
Raw Normal View History

{
"type": "Module",
"span": {
"start": 44,
"end": 400,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 44,
"end": 64,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 51,
"end": 64,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 55,
"end": 63,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 55,
"end": 58,
"ctxt": 0
},
"value": "foo",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 61,
"end": 63,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
},
"definite": false
}
]
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 99,
"end": 133,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 115,
"end": 116,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 106,
"end": 133,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 118,
"end": 133,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 121,
"end": 131,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 128,
"end": 130,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 163,
"end": 205,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 170,
"end": 205,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 177,
"end": 179,
"ctxt": 0
},
"value": "M2",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 180,
"end": 205,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 183,
"end": 203,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 190,
"end": 203,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 194,
"end": 202,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 194,
"end": 195,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BooleanLiteral",
"span": {
"start": 198,
"end": 202,
"ctxt": 0
},
"value": true
},
"definite": false
}
]
}
}
]
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 235,
"end": 269,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 242,
"end": 246,
"ctxt": 0
},
"value": "foo0",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 249,
"end": 268,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 257,
"end": 267,
"ctxt": 0
},
"value": "../foo_0",
"raw": "'../foo_0'"
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 270,
"end": 308,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 277,
"end": 281,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 284,
"end": 307,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 292,
"end": 306,
"ctxt": 0
},
"value": "./test/foo_1",
"raw": "'./test/foo_1'"
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 309,
"end": 352,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 316,
"end": 320,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 323,
"end": 351,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 331,
"end": 350,
"ctxt": 0
},
"value": "./.././test/foo_2",
"raw": "'./.././test/foo_2'"
}
}
},
{
"type": "IfStatement",
"span": {
"start": 354,
"end": 400,
"ctxt": 0
},
"test": {
"type": "MemberExpression",
"span": {
"start": 357,
"end": 366,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 357,
"end": 364,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 357,
"end": 361,
"ctxt": 0
},
"value": "foo2",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 362,
"end": 364,
"ctxt": 0
},
"value": "M2",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 365,
"end": 366,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 367,
"end": 400,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 370,
"end": 398,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 374,
"end": 397,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 374,
"end": 375,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 378,
"end": 397,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "MemberExpression",
"span": {
"start": 378,
"end": 386,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 378,
"end": 382,
"ctxt": 0
},
"value": "foo0",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 383,
"end": 386,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 389,
"end": 397,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 389,
"end": 395,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 389,
"end": 393,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 394,
"end": 395,
"ctxt": 0
},
"value": "f",
"optional": false
}
},
"arguments": [],
"typeArguments": null
}
},
"definite": false
}
]
}
]
},
"alternate": null
}
],
"interpreter": null
}