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

412 lines
9.2 KiB
JSON

{
"type": "Module",
"span": {
"start": 39,
"end": 244,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 39,
"end": 69,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 44,
"end": 47,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 51,
"end": 54,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 51,
"end": 54,
"ctxt": 0
},
"value": "red",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 56,
"end": 61,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 56,
"end": 61,
"ctxt": 0
},
"value": "green",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 63,
"end": 67,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 63,
"end": 67,
"ctxt": 0
},
"value": "blue",
"optional": false
},
"init": null
}
]
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 70,
"end": 109,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 77,
"end": 80,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 81,
"end": 109,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 84,
"end": 107,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 91,
"end": 107,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 95,
"end": 106,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 95,
"end": 101,
"ctxt": 0
},
"value": "answer",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 104,
"end": 106,
"ctxt": 0
},
"value": 42.0
},
"definite": false
}
]
}
}
]
}
},
{
"type": "TsExportAssignment",
"span": {
"start": 110,
"end": 123,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 119,
"end": 122,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 148,
"end": 180,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 155,
"end": 158,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 161,
"end": 179,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 169,
"end": 178,
"ctxt": 0
},
"value": "./foo_0",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 181,
"end": 196,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 185,
"end": 195,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 185,
"end": 190,
"ctxt": 0
},
"value": "color",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 190,
"end": 195,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 192,
"end": 195,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 192,
"end": 195,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 197,
"end": 244,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 200,
"end": 219,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 200,
"end": 205,
"ctxt": 0
},
"value": "color",
"optional": false
},
"right": {
"type": "MemberExpression",
"span": {
"start": 210,
"end": 219,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 210,
"end": 213,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 214,
"end": 219,
"ctxt": 0
},
"value": "green",
"optional": false
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 220,
"end": 244,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 223,
"end": 242,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 223,
"end": 241,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 223,
"end": 228,
"ctxt": 0
},
"value": "color",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 231,
"end": 241,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 231,
"end": 234,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 235,
"end": 241,
"ctxt": 0
},
"value": "answer",
"optional": false
}
}
}
}
]
},
"alternate": null
}
],
"interpreter": null
}