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

688 lines
18 KiB
JSON
Raw Normal View History

{
"type": "Module",
"span": {
"start": 44,
"end": 370,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 44,
"end": 117,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 51,
"end": 54,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 55,
"end": 117,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 58,
"end": 93,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": "a",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 65,
"end": 93,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 77,
"end": 93,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 81,
"end": 90,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"value": 5.0
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 95,
"end": 115,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 102,
"end": 115,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 106,
"end": 114,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 106,
"end": 107,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BooleanLiteral",
"span": {
"start": 110,
"end": 114,
"ctxt": 0
},
"value": true
},
"definite": false
}
]
}
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 118,
"end": 229,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 125,
"end": 128,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 129,
"end": 229,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 132,
"end": 176,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "c",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 150,
"end": 159,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 150,
"end": 159,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 151,
"end": 159,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 153,
"end": 159,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 139,
"end": 176,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 160,
"end": 176,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 164,
"end": 173,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 171,
"end": 172,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 178,
"end": 227,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 185,
"end": 227,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 192,
"end": 196,
"ctxt": 0
},
"value": "Test",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 197,
"end": 227,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 201,
"end": 224,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 208,
"end": 224,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 212,
"end": 223,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 212,
"end": 218,
"ctxt": 0
},
"value": "answer",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 221,
"end": 223,
"ctxt": 0
},
"value": 42.0
},
"definite": false
}
]
}
}
]
}
}
}
]
}
},
{
"type": "TsExportAssignment",
"span": {
"start": 230,
"end": 243,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 239,
"end": 242,
"ctxt": 0
},
"value": "Foo",
"optional": false
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 268,
"end": 300,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 275,
"end": 278,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 281,
"end": 299,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 289,
"end": 298,
"ctxt": 0
},
"value": "./foo_0",
"raw": "\"./foo_0\""
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 301,
"end": 325,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 305,
"end": 324,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 305,
"end": 306,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 306,
"end": 314,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 308,
"end": 314,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "CallExpression",
"span": {
"start": 317,
"end": 324,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 317,
"end": 322,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 317,
"end": 320,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 321,
"end": 322,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 326,
"end": 370,
"ctxt": 0
},
"test": {
"type": "UnaryExpression",
"span": {
"start": 329,
"end": 336,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "UnaryExpression",
"span": {
"start": 330,
"end": 336,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "MemberExpression",
"span": {
"start": 331,
"end": 336,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 331,
"end": 334,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 335,
"end": 336,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 337,
"end": 370,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 340,
"end": 368,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 340,
"end": 367,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 340,
"end": 355,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 340,
"end": 348,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 340,
"end": 343,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 344,
"end": 348,
"ctxt": 0
},
"value": "Test",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 349,
"end": 355,
"ctxt": 0
},
"value": "answer",
"optional": false
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 358,
"end": 367,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 358,
"end": 363,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 358,
"end": 361,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 362,
"end": 363,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 364,
"end": 366,
"ctxt": 0
},
"value": 42.0
}
}
],
"typeArguments": null
}
}
}
]
},
"alternate": null
}
],
"interpreter": null
}