aboutsummaryrefslogtreecommitdiffstats
path: root/src/lift.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lift.cpp')
-rw-r--r--src/lift.cpp46
1 files changed, 2 insertions, 44 deletions
diff --git a/src/lift.cpp b/src/lift.cpp
index 239b02e..5791e41 100644
--- a/src/lift.cpp
+++ b/src/lift.cpp
@@ -213,48 +213,6 @@ lift_let(CEnv& cenv, Code& code, const ATuple* let) throw()
}
static const AST*
-lift_match(CEnv& cenv, Code& code, const ATuple* match) throw()
-{
- List<ATuple, const AST> copy(match->loc, cenv.penv.sym("let"), NULL);
- List<ATuple, const AST> copyVars;
-
- const ASymbol* tsym = cenv.penv.gensym("_matchT");
-
- List<ATuple, const AST> tval;
- tval.push_back(cenv.penv.sym("."));
- tval.push_back(resp_lift(cenv, code, match->list_ref(1)));
- tval.push_back(new ALiteral<int32_t>(T_INT32, 0, Cursor()));
-
- copyVars.push_back(tsym);
- copyVars.push_back(tval);
- copy.push_back(copyVars);
-
- List<ATuple, const AST> copyIf;
- copyIf.push_back(cenv.penv.sym("if"));
- for (ATuple::const_iterator i = match->iter_at(2); i != match->end();) {
- const ATuple* pat = (*i++)->as_tuple();
- const AST* body = *i++;
-
- List<ATuple, const AST> cond;
- cond.push_back(cenv.penv.sym("__tag_is"));
- cond.push_back(tsym);
- cond.push_back(pat->head());
-
- copyIf.push_back(cond);
- const AST* liftedBody = resp_lift(cenv, code, body);
- assert(liftedBody);
- copyIf.push_back(liftedBody);
- }
- copyIf.push_back(cenv.penv.sym("__unreachable"));
- copy.push_back(copyIf);
-
- cenv.setTypeSameAs(copyIf, match);
- cenv.setTypeSameAs(copy, match);
-
- return copy;
-}
-
-static const AST*
lift_call(CEnv& cenv, Code& code, const ATuple* call) throw()
{
List<ATuple, const AST> copy;
@@ -345,8 +303,8 @@ resp_lift(CEnv& cenv, Code& code, const AST* ast) throw()
return lift_args(cenv, code, call);
else if (form == "let")
return lift_let(cenv, code, call);
- else if (form == "match")
- return lift_match(cenv, code, call);
+ else if (form == "__tag_is")
+ return call;
else
return lift_call(cenv, code, call);
}