| 1064 | } |
| 1065 | |
| 1066 | function genIfStatement(node: IfStatement, context: CodegenContext) { |
| 1067 | const { push, indent, deindent } = context |
| 1068 | const { test, consequent, alternate } = node |
| 1069 | push(`if (`) |
| 1070 | genNode(test, context) |
| 1071 | push(`) {`) |
| 1072 | indent() |
| 1073 | genNode(consequent, context) |
| 1074 | deindent() |
| 1075 | push(`}`) |
| 1076 | if (alternate) { |
| 1077 | push(` else `) |
| 1078 | if (alternate.type === NodeTypes.JS_IF_STATEMENT) { |
| 1079 | genIfStatement(alternate, context) |
| 1080 | } else { |
| 1081 | push(`{`) |
| 1082 | indent() |
| 1083 | genNode(alternate, context) |
| 1084 | deindent() |
| 1085 | push(`}`) |
| 1086 | } |
| 1087 | } |
| 1088 | } |
| 1089 | |
| 1090 | function genAssignmentExpression( |
| 1091 | node: AssignmentExpression, |