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

632 lines
16 KiB
JSON

{
"type": "Module",
"span": {
"start": 59,
"end": 491,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 59,
"end": 111,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 66,
"end": 111,
"ctxt": 0
},
"declare": true,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 81,
"end": 83,
"ctxt": 0
},
"value": "M2",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 84,
"end": 111,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 87,
"end": 109,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 94,
"end": 109,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 98,
"end": 108,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 98,
"end": 99,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 99,
"end": 108,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 101,
"end": 108,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
}
}
]
}
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 143,
"end": 194,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 150,
"end": 194,
"ctxt": 0
},
"declare": true,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 165,
"end": 167,
"ctxt": 0
},
"value": "M2",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 168,
"end": 194,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 171,
"end": 192,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 178,
"end": 192,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 182,
"end": 191,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 182,
"end": 183,
"ctxt": 0
},
"value": "x",
"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": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 245,
"end": 249,
"ctxt": 0
},
"value": "Test",
"optional": false
},
"declare": true,
"span": {
"start": 231,
"end": 278,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 253,
"end": 276,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 253,
"end": 264,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 265,
"end": 274,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 265,
"end": 274,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 266,
"end": 274,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 268,
"end": 274,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": null,
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "TsExportAssignment",
"span": {
"start": 279,
"end": 293,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 288,
"end": 292,
"ctxt": 0
},
"value": "Test",
"optional": false
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 323,
"end": 351,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 330,
"end": 333,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 336,
"end": 350,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 344,
"end": 349,
"ctxt": 0
},
"value": "foo",
"raw": "'foo'"
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 352,
"end": 386,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 359,
"end": 364,
"ctxt": 0
},
"value": "other",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 367,
"end": 385,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 375,
"end": 384,
"ctxt": 0
},
"value": "./other",
"raw": "'./other'"
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 387,
"end": 427,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 394,
"end": 400,
"ctxt": 0
},
"value": "relMod",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 403,
"end": 426,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 411,
"end": 425,
"ctxt": 0
},
"value": "./sub/relMod",
"raw": "'./sub/relMod'"
}
}
},
{
"type": "IfStatement",
"span": {
"start": 429,
"end": 491,
"ctxt": 0
},
"test": {
"type": "MemberExpression",
"span": {
"start": 432,
"end": 440,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 432,
"end": 438,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 432,
"end": 435,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 436,
"end": 438,
"ctxt": 0
},
"value": "M2",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 439,
"end": 440,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 441,
"end": 491,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 444,
"end": 489,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 448,
"end": 488,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 448,
"end": 449,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 452,
"end": 488,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 456,
"end": 462,
"ctxt": 0
},
"value": "relMod",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 463,
"end": 487,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 463,
"end": 484,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 463,
"end": 473,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 463,
"end": 471,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 463,
"end": 468,
"ctxt": 0
},
"value": "other",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 469,
"end": 471,
"ctxt": 0
},
"value": "M2",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 472,
"end": 473,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 474,
"end": 484,
"ctxt": 0
},
"value": "charCodeAt",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 485,
"end": 486,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
],
"typeArguments": null
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
]
},
"alternate": null
}
],
"interpreter": null
}