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

691 lines
18 KiB
JSON

{
"type": "Module",
"span": {
"start": 45,
"end": 371,
"ctxt": 0
},
"body": [
{
"type": "TsModuleDeclaration",
"span": {
"start": 45,
"end": 118,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 52,
"end": 55,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 56,
"end": 118,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 59,
"end": 94,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 75,
"end": 76,
"ctxt": 0
},
"value": "a",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 66,
"end": 94,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 78,
"end": 94,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 82,
"end": 91,
"ctxt": 0
},
"argument": {
"type": "NumericLiteral",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"value": 5.0,
"raw": "5"
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 96,
"end": 116,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 103,
"end": 116,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 107,
"end": 115,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 107,
"end": 108,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BooleanLiteral",
"span": {
"start": 111,
"end": 115,
"ctxt": 0
},
"value": true
},
"definite": false
}
]
}
}
]
}
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 119,
"end": 230,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 126,
"end": 129,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 130,
"end": 230,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 133,
"end": 177,
"ctxt": 0
},
"declaration": {
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"value": "c",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 151,
"end": 160,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 151,
"end": 160,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 152,
"end": 160,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 154,
"end": 160,
"ctxt": 0
},
"kind": "number"
}
}
}
}
],
"decorators": [],
"span": {
"start": 140,
"end": 177,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 161,
"end": 177,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 165,
"end": 174,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "a",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 179,
"end": 228,
"ctxt": 0
},
"declaration": {
"type": "TsModuleDeclaration",
"span": {
"start": 186,
"end": 228,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 193,
"end": 197,
"ctxt": 0
},
"value": "Test",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 198,
"end": 228,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 202,
"end": 225,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 209,
"end": 225,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 213,
"end": 224,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 213,
"end": 219,
"ctxt": 0
},
"value": "answer",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 222,
"end": 224,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
},
"definite": false
}
]
}
}
]
}
}
}
]
}
},
{
"type": "TsExportAssignment",
"span": {
"start": 231,
"end": 244,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 240,
"end": 243,
"ctxt": 0
},
"value": "Foo",
"optional": false
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 269,
"end": 301,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 276,
"end": 279,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 282,
"end": 300,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 290,
"end": 299,
"ctxt": 0
},
"value": "./foo_0",
"raw": "\"./foo_0\""
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 302,
"end": 326,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 306,
"end": 325,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 306,
"end": 307,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 307,
"end": 315,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 309,
"end": 315,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": {
"type": "CallExpression",
"span": {
"start": 318,
"end": 325,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 318,
"end": 323,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 318,
"end": 321,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 322,
"end": 323,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 327,
"end": 371,
"ctxt": 0
},
"test": {
"type": "UnaryExpression",
"span": {
"start": 330,
"end": 337,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "UnaryExpression",
"span": {
"start": 331,
"end": 337,
"ctxt": 0
},
"operator": "!",
"argument": {
"type": "MemberExpression",
"span": {
"start": 332,
"end": 337,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 332,
"end": 335,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 336,
"end": 337,
"ctxt": 0
},
"value": "b",
"optional": false
}
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 338,
"end": 371,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 341,
"end": 369,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 341,
"end": 368,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 341,
"end": 356,
"ctxt": 0
},
"object": {
"type": "MemberExpression",
"span": {
"start": 341,
"end": 349,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 341,
"end": 344,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 345,
"end": 349,
"ctxt": 0
},
"value": "Test",
"optional": false
}
},
"property": {
"type": "Identifier",
"span": {
"start": 350,
"end": 356,
"ctxt": 0
},
"value": "answer",
"optional": false
}
},
"right": {
"type": "CallExpression",
"span": {
"start": 359,
"end": 368,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 359,
"end": 364,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 359,
"end": 362,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 363,
"end": 364,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 365,
"end": 367,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
}
}
],
"typeArguments": null
}
}
}
]
},
"alternate": null
}
],
"interpreter": null
}