aboutsummaryrefslogtreecommitdiffstats
path: root/src/compile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compile.cpp')
-rw-r--r--src/compile.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/compile.cpp b/src/compile.cpp
index e2d306a..da9683e 100644
--- a/src/compile.cpp
+++ b/src/compile.cpp
@@ -40,7 +40,7 @@ AString::compile(CEnv& cenv) const throw()
CVal
AQuote::compile(CEnv& cenv) const throw()
{
- return (*(begin() + 1))->compile(cenv);
+ return list_ref(1)->compile(cenv);
}
CVal
@@ -77,7 +77,7 @@ AFn::compile(CEnv& cenv) const throw()
// Write function body
CVal retVal = NULL;
- for (AFn::const_iterator i = begin() + 2; i != end(); ++i)
+ for (AFn::const_iterator i = iter_at(2); i != end(); ++i)
retVal = (*i)->compile(cenv);
// Write function conclusion
@@ -101,7 +101,7 @@ ACall::compile(CEnv& cenv) const throw()
f = cenv.currentFn; // Recursive call (callee defined as a stub)
vector<CVal> args;
- for (const_iterator e = begin() + 1; e != end(); ++e)
+ for (const_iterator e = iter_at(1); e != end(); ++e)
args.push_back((*e)->compile(cenv));
return cenv.engine()->compileCall(cenv, f, cenv.type(head()), args);
@@ -136,10 +136,11 @@ ACons::compile(CEnv& cenv) const throw()
CVal
ATuple::compile(CEnv& cenv) const throw()
{
- AType* type = tup<AType>(loc, const_cast<ASymbol*>(head()->as<const ASymbol*>()), 0);
+ AType* type = new AType(const_cast<ASymbol*>(head()->as<const ASymbol*>()), NULL, Cursor());
+ TList tlist(type);
vector<CVal> fields;
- for (const_iterator i = begin() + 1; i != end(); ++i) {
- type->push_back(const_cast<AType*>(cenv.type(*i)));
+ for (const_iterator i = iter_at(1); i != end(); ++i) {
+ tlist.push_back(const_cast<AType*>(cenv.type(*i)));
fields.push_back((*i)->compile(cenv));
}
return cenv.engine()->compileTup(cenv, type, type->compile(cenv), fields);
@@ -162,9 +163,9 @@ AType::compile(CEnv& cenv) const throw()
CVal
ADot::compile(CEnv& cenv) const throw()
{
- const_iterator i = begin();
- AST* tup = *++i;
- ALiteral<int32_t>* index = (*++i)->as<ALiteral<int32_t>*>();
+ const_iterator i = begin();
+ const AST* tup = *++i;
+ const ALiteral<int32_t>* index = (*++i)->as<const ALiteral<int32_t>*>();
CVal tupVal = tup->compile(cenv);
return cenv.engine()->compileDot(cenv, tupVal, index->val);
}