aboutsummaryrefslogtreecommitdiffstats
path: root/src/c.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/c.cpp')
-rw-r--r--src/c.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/c.cpp b/src/c.cpp
index 795a57f..74dceb2 100644
--- a/src/c.cpp
+++ b/src/c.cpp
@@ -43,12 +43,12 @@ static const Type*
llType(const AType* t)
{
if (t->kind == AType::PRIM) {
- if (t->at(0)->str() == "Nothing") return new string("void");
- if (t->at(0)->str() == "Bool") return new string("bool");
- if (t->at(0)->str() == "Int") return new string("int");
- if (t->at(0)->str() == "Float") return new string("float");
+ if (t->head()->str() == "Nothing") return new string("void");
+ if (t->head()->str() == "Bool") return new string("bool");
+ if (t->head()->str() == "Int") return new string("int");
+ if (t->head()->str() == "Float") return new string("float");
throw Error(t->loc, string("Unknown primitive type `") + t->str() + "'");
- } else if (t->kind == AType::EXPR && t->at(0)->str() == "Fn") {
+ } else if (t->kind == AType::EXPR && t->head()->str() == "Fn") {
const AType* retT = t->at(2)->as<const AType*>();
if (!llType(retT))
return NULL;
@@ -264,7 +264,7 @@ CEngine::compilePrimitive(CEnv& cenv, APrimitive* prim)
CEngine* engine = reinterpret_cast<CEngine*>(cenv.engine());
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();
+ const string n = prim->head()->to<ASymbol*>()->str();
string op = n;
// Convert operator to C operator if they don't match