aboutsummaryrefslogtreecommitdiffstats
path: root/src/compile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compile.cpp')
-rw-r--r--src/compile.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/compile.cpp b/src/compile.cpp
index 44017ec..ba8cc5e 100644
--- a/src/compile.cpp
+++ b/src/compile.cpp
@@ -167,11 +167,18 @@ compile_fn(CEnv& cenv, const ATuple* fn) throw()
static CVal
compile_if(CEnv& cenv, const ATuple* aif) throw()
{
+ const AST* cond = aif->list_ref(1);
+ const AST* then = aif->list_ref(2);
const AST* aelse = NULL;
if (*aif->list_last() != *cenv.penv.sym("__unreachable"))
aelse = aif->list_ref(3);
- return cenv.engine()->compileIf(cenv, aif->list_ref(1), aif->list_ref(2), aelse);
+ const AST* type = cenv.type(then);
+
+ cenv.engine()->compileIfStart(cenv, cond, type);
+ cenv.engine()->compileIfThen(cenv, resp_compile(cenv, then));
+ cenv.engine()->compileIfElse(cenv, resp_compile(cenv, aelse));
+ return cenv.engine()->compileIfEnd(cenv);
}
static CVal
@@ -214,6 +221,9 @@ compile_call(CEnv& cenv, const ATuple* call) throw()
CVal
resp_compile(CEnv& cenv, const AST* ast) throw()
{
+ if (!ast)
+ return NULL;
+
switch (ast->tag()) {
case T_UNKNOWN:
return NULL;