aboutsummaryrefslogtreecommitdiffstats
path: root/src/simplify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/simplify.cpp')
-rw-r--r--src/simplify.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/simplify.cpp b/src/simplify.cpp
index 23acad7..715202a 100644
--- a/src/simplify.cpp
+++ b/src/simplify.cpp
@@ -28,7 +28,7 @@ using namespace std;
static const AST*
simplify_if(CEnv& cenv, const ATuple* aif) throw()
{
- List<ATuple, const AST> copy(aif->loc, cenv.penv.sym("if"), NULL);
+ List copy(aif->loc, cenv.penv.sym("if"), NULL);
copy.push_back(aif->list_ref(1));
copy.push_back(aif->list_ref(2));
@@ -39,7 +39,7 @@ simplify_if(CEnv& cenv, const ATuple* aif) throw()
if (++next == aif->end())
break;
- List<ATuple, const AST> inner_if((*i)->loc, cenv.penv.sym("if"), *i, *next, NULL);
+ List inner_if((*i)->loc, cenv.penv.sym("if"), *i, *next, NULL);
tail->last(new ATuple(inner_if.head, NULL, Cursor()));
tail = inner_if.tail;
@@ -58,22 +58,23 @@ simplify_match(CEnv& cenv, const ATuple* match) throw()
{
// Dot expression to get tag. Note index is -1 to compensate for the lift phase
// which adds 1 to skip the RTTI, which we don't want here (FIXME: ick...)
- List<ATuple, const AST> tval;
+ List tval;
tval.push_back(cenv.penv.sym("."));
tval.push_back(resp_simplify(cenv, match->list_ref(1)));
tval.push_back(new ALiteral<int32_t>(T_INT32, -1, Cursor()));
const ASymbol* tsym = cenv.penv.gensym("_matchT");
- List<ATuple, const AST> def(match->loc, cenv.penv.sym("def"), tsym, tval.head, NULL);
-
- List<ATuple, const AST> copyIf;
+ List def(match->loc, cenv.penv.sym("def"), tsym, tval.head, NULL);
+ cenv.setType(tval.head, cenv.tenv.named("String"));
+
+ List 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;
+ List cond;
cond.push_back(cenv.penv.sym("__tag_is"));
cond.push_back(tsym);
cond.push_back(pat->head());
@@ -84,7 +85,7 @@ simplify_match(CEnv& cenv, const ATuple* match) throw()
copyIf.push_back(cenv.penv.sym("__unreachable"));
cenv.setTypeSameAs(copyIf, match);
- List<ATuple, const AST> copy;
+ List copy;
copy.push_back(cenv.penv.sym("do"));
copy.push_back(def);
copy.push_back(simplify_if(cenv, copyIf));
@@ -96,7 +97,7 @@ simplify_match(CEnv& cenv, const ATuple* match) throw()
static const AST*
simplify_list(CEnv& cenv, const ATuple* call) throw()
{
- List<ATuple, const AST> copy;
+ List copy;
for (ATuple::const_iterator i = call->begin(); i != call->end(); ++i)
copy.push_back(resp_simplify(cenv, *i));
@@ -110,11 +111,11 @@ simplify_let(CEnv& cenv, const ATuple* call) throw()
{
const ATuple* vars = call->list_ref(1)->to_tuple();
- List<ATuple, const AST> fn(Cursor(), cenv.penv.sym("fn"), NULL);
+ List fn(Cursor(), cenv.penv.sym("fn"), NULL);
- List<ATuple, const AST> fnProt;
- List<ATuple, const AST> fnArgs;
- List<AType, const AType> fnProtT;
+ List fnProt;
+ List fnArgs;
+ List fnProtT;
for (ATuple::const_iterator i = vars->begin(); i != vars->end();) {
const ASymbol* sym = (*i++)->to_symbol();
const AST* val = (*i++);
@@ -126,7 +127,7 @@ simplify_let(CEnv& cenv, const ATuple* call) throw()
fn.push_back(fnProt.head);
fn.push_back(resp_simplify(cenv, call->list_ref(2)));
- List<AType, const AType> fnT;
+ List fnT;
fnT.push_back(cenv.tenv.Fn);
fnT.push_back(fnProtT);
fnT.push_back(cenv.type(call->list_ref(2)));