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

409 lines
9.2 KiB
JSON
Raw Normal View History

{
"type": "Module",
"span": {
"start": 40,
"end": 245,
"ctxt": 0
},
"body": [
{
"type": "TsEnumDeclaration",
"span": {
"start": 40,
"end": 70,
"ctxt": 0
},
"declare": false,
"isConst": false,
"id": {
"type": "Identifier",
"span": {
"start": 45,
"end": 48,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"members": [
{
"type": "TsEnumMember",
"span": {
"start": 52,
"end": 55,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 52,
"end": 55,
"ctxt": 0
},
"value": "red",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 57,
"end": 62,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 57,
"end": 62,
"ctxt": 0
},
"value": "green",
"optional": false
},
"init": null
},
{
"type": "TsEnumMember",
"span": {
"start": 64,
"end": 68,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 64,
"end": 68,
"ctxt": 0
},
"value": "blue",
"optional": false
},
"init": null
}
]
},
{
"type": "TsModuleDeclaration",
"span": {
"start": 71,
"end": 110,
"ctxt": 0
},
"declare": false,
"global": false,
"id": {
"type": "Identifier",
"span": {
"start": 78,
"end": 81,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"body": {
"type": "TsModuleBlock",
"span": {
"start": 82,
"end": 110,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 85,
"end": 108,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 92,
"end": 108,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 96,
"end": 107,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 96,
"end": 102,
"ctxt": 0
},
"value": "answer",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 105,
"end": 107,
"ctxt": 0
},
"value": 42.0,
"raw": "42"
},
"definite": false
}
]
}
}
]
}
},
{
"type": "TsExportAssignment",
"span": {
"start": 111,
"end": 124,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 120,
"end": 123,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 149,
"end": 181,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 156,
"end": 159,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 162,
"end": 180,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 170,
"end": 179,
"ctxt": 0
},
"value": "./foo_0",
"raw": "\"./foo_0\""
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 182,
"end": 197,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 186,
"end": 196,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 186,
"end": 191,
"ctxt": 0
},
"value": "color",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 191,
"end": 196,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 198,
"end": 245,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 201,
"end": 220,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 201,
"end": 206,
"ctxt": 0
},
"value": "color",
"optional": false
},
"right": {
"type": "MemberExpression",
"span": {
"start": 211,
"end": 220,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 211,
"end": 214,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 215,
"end": 220,
"ctxt": 0
},
"value": "green",
"optional": false
}
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 221,
"end": 245,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 224,
"end": 243,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 224,
"end": 242,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 224,
"end": 229,
"ctxt": 0
},
"value": "color",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "MemberExpression",
"span": {
"start": 232,
"end": 242,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 232,
"end": 235,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 236,
"end": 242,
"ctxt": 0
},
"value": "answer",
"optional": false
}
}
}
}
]
},
"alternate": null
}
],
"interpreter": null
}