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

326 lines
7.3 KiB
JSON

{
"type": "Module",
"span": {
"start": 39,
"end": 225,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 48,
"end": 51,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 39,
"end": 73,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 54,
"end": 73,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 57,
"end": 71,
"ctxt": 0
},
"argument": {
"type": "StringLiteral",
"span": {
"start": 64,
"end": 70,
"ctxt": 0
},
"value": "test",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 74,
"end": 113,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 81,
"end": 84,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 85,
"end": 113,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 88,
"end": 111,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 95,
"end": 111,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 99,
"end": 110,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 99,
"end": 105,
"ctxt": 0
},
"value": "answer",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 108,
"end": 110,
"ctxt": 0
},
"value": 42.0
},
"definite": false
}
]
}
}
]
}
},
{
"type": "TsExportAssignment",
"span": {
"start": 114,
"end": 127,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 123,
"end": 126,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 152,
"end": 184,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 159,
"end": 162,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 165,
"end": 183,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 173,
"end": 182,
"ctxt": 0
},
"value": "./foo_0",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "IfStatement",
"span": {
"start": 185,
"end": 225,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 188,
"end": 205,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "MemberExpression",
"span": {
"start": 188,
"end": 198,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 188,
"end": 191,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 192,
"end": 198,
"ctxt": 0
},
"value": "answer",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 203,
"end": 205,
"ctxt": 0
},
"value": 42.0
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 206,
"end": 225,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 209,
"end": 223,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 213,
"end": 222,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 217,
"end": 222,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 217,
"end": 220,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
}
]
},
"alternate": null
}
],
"interpreter": null
}