aboutsummaryrefslogtreecommitdiffstats
path: root/src/c.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/c.cpp')
-rw-r--r--src/c.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/c.cpp b/src/c.cpp
index b6a8c26..bf98638 100644
--- a/src/c.cpp
+++ b/src/c.cpp
@@ -220,7 +220,7 @@ CEngine::compileFunction(CEnv& cenv, AFn* fn, const AType& argsT)
fn->impls.push_back(make_pair(thisType, f));
CVal retVal = NULL;
for (size_t i = 2; i < fn->size(); ++i)
- retVal = cenv.compile(fn->at(i));
+ retVal = fn->at(i)->compile(cenv);
cenv.engine()->finishFunction(cenv, f, cenv.type(fn->at(fn->size() - 1)), retVal);
} catch (Error& e) {
cenv.pop();
@@ -241,16 +241,16 @@ CEngine::compileIf(CEnv& cenv, AIf* aif)
if (i > 1)
out += "else {\n";
- Value* condV = llVal(cenv.compile(aif->at(i)));
+ Value* condV = llVal(aif->at(i)->compile(cenv));
out += (format("if (%s) {\n") % *condV).str();
- Value* thenV = llVal(cenv.compile(aif->at(i + 1)));
+ Value* thenV = llVal(aif->at(i + 1)->compile(cenv));
out += (format("%s = %s;\n}\n") % *varname % *thenV).str();
}
// Emit final else block
out += "else {\n";
- Value* elseV = llVal(cenv.compile(aif->at(aif->size() - 1)));
+ Value* elseV = llVal(aif->at(aif->size() - 1)->compile(cenv));
out += (format("%s = %s;\n}\n") % *varname % *elseV).str();
for (size_t i = 1; i < (aif->size() - 1) / 2; ++i)
@@ -263,8 +263,8 @@ CVal
CEngine::compilePrimitive(CEnv& cenv, APrimitive* prim)
{
CEngine* engine = reinterpret_cast<CEngine*>(cenv.engine());
- Value* a = llVal(cenv.compile(prim->at(1)));
- Value* b = llVal(cenv.compile(prim->at(2)));
+ Value* a = llVal(prim->at(1)->compile(cenv));
+ Value* b = llVal(prim->at(2)->compile(cenv));
const string n = prim->at(0)->to<ASymbol*>()->str();
string op = n;
@@ -279,7 +279,7 @@ CEngine::compilePrimitive(CEnv& cenv, APrimitive* prim)
string val("(");
val += *a + op + *b;
for (size_t i = 3; i < prim->size(); ++i)
- val += op + *llVal(cenv.compile(prim->at(i)));
+ val += op + *llVal(prim->at(i)->compile(cenv));
val += ")";
Value* varname = new string(cenv.penv.gensymstr("x"));