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

643 lines
17 KiB
JSON

{
"type": "Module",
"span": {
"start": 58,
"end": 490,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 58,
"end": 110,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 65,
"end": 110,
"ctxt": 0
},
"declare": true,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 80,
"end": 82,
"ctxt": 0
},
"value": "M2",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 83,
"end": 110,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 86,
"end": 108,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 93,
"end": 108,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 97,
"end": 107,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 98,
"end": 107,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 100,
"end": 107,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
}
}
]
}
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 142,
"end": 193,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 149,
"end": 193,
"ctxt": 0
},
"declare": true,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 164,
"end": 166,
"ctxt": 0
},
"value": "M2",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 167,
"end": 193,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 170,
"end": 191,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 177,
"end": 191,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 181,
"end": 190,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 181,
"end": 182,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 182,
"end": 190,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 184,
"end": 190,
"ctxt": 0
},
"kind": "string"
}
}
},
"init": null,
"definite": false
}
]
}
}
]
}
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 244,
"end": 248,
"ctxt": 0
},
"value": "Test",
"optional": false
},
"declare": true,
"span": {
"start": 230,
"end": 277,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 252,
"end": 275,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 252,
"end": 263,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 264,
"end": 273,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 264,
"end": 273,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 265,
"end": 273,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 267,
"end": 273,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"body": null,
"accessibility": null,
"isOptional": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "TsExportAssignment",
"span": {
"start": 278,
"end": 292,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 287,
"end": 291,
"ctxt": 0
},
"value": "Test",
"optional": false
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 322,
"end": 350,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 329,
"end": 332,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 335,
"end": 349,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 343,
"end": 348,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 351,
"end": 385,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 358,
"end": 363,
"ctxt": 0
},
"value": "other",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 366,
"end": 384,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 374,
"end": 383,
"ctxt": 0
},
"value": "./other",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 386,
"end": 426,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 393,
"end": 399,
"ctxt": 0
},
"value": "relMod",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 402,
"end": 425,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 410,
"end": 424,
"ctxt": 0
},
"value": "./sub/relMod",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "IfStatement",
"span": {
"start": 428,
"end": 490,
"ctxt": 0
},
"test": {
"type": "MemberExpression",
"span": {
"start": 431,
"end": 439,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 431,
"end": 437,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 431,
"end": 434,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 435,
"end": 437,
"ctxt": 0
},
"value": "M2",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 438,
"end": 439,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 440,
"end": 490,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 443,
"end": 488,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 447,
"end": 487,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 447,
"end": 448,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 451,
"end": 487,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 455,
"end": 461,
"ctxt": 0
},
"value": "relMod",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "CallExpression",
"span": {
"start": 462,
"end": 486,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 462,
"end": 483,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 462,
"end": 472,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 462,
"end": 470,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 462,
"end": 467,
"ctxt": 0
},
"value": "other",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 468,
"end": 470,
"ctxt": 0
},
"value": "M2",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 471,
"end": 472,
"ctxt": 0
},
"value": "x",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 473,
"end": 483,
"ctxt": 0
},
"value": "charCodeAt",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 484,
"end": 485,
"ctxt": 0
},
"value": 0.0
}
}
],
"typeArguments": null
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
]
},
"alternate": null
}
],
"interpreter": null
}