aboutsummaryrefslogtreecommitdiffstats
path: root/src/lift.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lift.cpp')
-rw-r--r--src/lift.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/lift.cpp b/src/lift.cpp
index 2df27c9..f39239e 100644
--- a/src/lift.cpp
+++ b/src/lift.cpp
@@ -40,7 +40,7 @@ lift_symbol(CEnv& cenv, Code& code, ASymbol* sym) throw()
const int32_t index = cenv.liftStack.top().index(sym);
// Replace symbol with code to access free variable from closure
- return tup<ACall>(sym->loc, cenv.penv.sym("."),
+ return tup<ATuple>(sym->loc, cenv.penv.sym("."),
cenv.penv.sym("_me"),
new ALiteral<int32_t>(index, Cursor()),
NULL);
@@ -50,9 +50,9 @@ lift_symbol(CEnv& cenv, Code& code, ASymbol* sym) throw()
}
static AST*
-lift_fn(CEnv& cenv, Code& code, ACall* fn) throw()
+lift_fn(CEnv& cenv, Code& code, ATuple* fn) throw()
{
- ACall* impl = new ACall(fn);
+ ATuple* impl = new ATuple(*fn);
const string fnName = cenv.name(fn);
const string nameBase = cenv.penv.gensymstr(((fnName != "") ? fnName : "fn").c_str());
const string implNameStr = string("_") + nameBase;
@@ -99,13 +99,13 @@ lift_fn(CEnv& cenv, Code& code, ACall* fn) throw()
// Create definition for implementation fn
ASymbol* implName = cenv.penv.sym(implNameStr);
- ACall* def = tup<ACall>(fn->loc, cenv.penv.sym("def"), implName, impl, NULL);
+ ATuple* def = tup<ATuple>(fn->loc, cenv.penv.sym("def"), implName, impl, NULL);
code.push_back(def);
AType* implT = new AType(*type); // Type of the implementation function
TList tupT(fn->loc, cenv.tenv.Tup, cenv.tenv.var(), NULL);
TList consT(fn->loc, cenv.tenv.Tup, implT, NULL);
- List<ACall, AST> cons(fn->loc, cenv.penv.sym("Closure"), implName, NULL);
+ List<ATuple, AST> cons(fn->loc, cenv.penv.sym("Closure"), implName, NULL);
implT->list_ref(1) = implProtT;
@@ -131,9 +131,9 @@ lift_fn(CEnv& cenv, Code& code, ACall* fn) throw()
}
static AST*
-lift_call(CEnv& cenv, Code& code, ACall* call) throw()
+lift_call(CEnv& cenv, Code& code, ATuple* call) throw()
{
- List<ACall, AST> copy;
+ List<ATuple, AST> copy;
// Lift all children (callee and arguments, recursively)
for (ATuple::iterator i = call->begin(); i != call->end(); ++i)
@@ -164,7 +164,7 @@ lift_call(CEnv& cenv, Code& code, ACall* call) throw()
copyT = implT->list_ref(2)->as<const AType*>();
} else {
// Call to a closure, prepend code to access implementation function
- ACall* getFn = tup<ACall>(call->loc, cenv.penv.sym("."),
+ ATuple* getFn = tup<ATuple>(call->loc, cenv.penv.sym("."),
copy.head->head(),
new ALiteral<int32_t>(0, Cursor()), NULL);
const AType* calleeT = cenv.type(copy.head->head());
@@ -180,17 +180,17 @@ lift_call(CEnv& cenv, Code& code, ACall* call) throw()
}
static AST*
-lift_def(CEnv& cenv, Code& code, ACall* def) throw()
+lift_def(CEnv& cenv, Code& code, ATuple* def) throw()
{
// Define stub first for recursion
const ASymbol* const sym = def->list_ref(1)->as<const ASymbol*>();
AST* const body = def->list_ref(2);
cenv.def(sym, body, cenv.type(body), NULL);
if (is_form(body, "fn"))
- cenv.setName(body->as<const ACall*>(), sym->str());
+ cenv.setName(body->as<const ATuple*>(), sym->str());
assert(def->list_ref(1)->to<const ASymbol*>());
- List<ACall, AST> copy;
+ List<ATuple, AST> copy;
copy.push_back(def->head());
copy.push_back(resp_lift(cenv, code, def->list_ref(1)));
for (ATuple::iterator t = def->iter_at(2); t != def->end(); ++t)
@@ -209,9 +209,9 @@ lift_def(CEnv& cenv, Code& code, ACall* def) throw()
}
static AST*
-lift_builtin_call(CEnv& cenv, Code& code, ACall* call) throw()
+lift_builtin_call(CEnv& cenv, Code& code, ATuple* call) throw()
{
- List<ACall, AST> copy;
+ List<ATuple, AST> copy;
copy.push_back(call->head());
// Lift all arguments
@@ -229,7 +229,7 @@ resp_lift(CEnv& cenv, Code& code, AST* ast) throw()
if (sym)
return lift_symbol(cenv, code, sym);
- ACall* const call = ast->to<ACall*>();
+ ATuple* const call = ast->to<ATuple*>();
if (call) {
const ASymbol* const sym = call->head()->to<const ASymbol*>();
const std::string form = sym ? sym->cppstr : "";