diff options
Diffstat (limited to 'src/c.cpp')
-rw-r--r-- | src/c.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -73,7 +73,7 @@ llType(const AType* t) return ret; } else if (t->kind == AType::EXPR && t->head()->str() == "Tup") { Type* ret = new Type("struct { void* me; "); - for (AType::const_iterator i = t->begin() + 1; i != t->end(); ++i) { + for (AType::const_iterator i = t->iter_at(1); i != t->end(); ++i) { const Type* lt = llType((*i)->to<const AType*>()); if (!lt) return NULL; @@ -104,11 +104,11 @@ struct CEngine : public Engine { const std::string& name, const ATuple* args, const AType* type) { const AType* argsT = type->prot()->as<const AType*>(); - const AType* retT = type->last()->as<const AType*>(); + const AType* retT = type->list_ref(2)->as<const AType*>(); vector<const Type*> cprot; FOREACHP(ATuple::const_iterator, i, argsT) { - AType* at = (*i)->as<AType*>(); + const AType* at = (*i)->as<const AType*>(); THROW_IF(!llType(at), Cursor(), string("non-concrete parameter :: ") + at->str()) cprot.push_back(llType(at)); @@ -222,10 +222,10 @@ CEngine::pushFunctionArgs(CEnv& cenv, const AFn* fn, const AType* type, CFunc f) AFn::const_iterator p = fn->prot()->begin(); ATuple::const_iterator pT = argsT->begin(); for (; p != fn->prot()->end(); ++p, ++pT) { - AType* t = (*pT)->as<AType*>(); + const AType* t = (*pT)->as<const AType*>(); const Type* lt = llType(t); THROW_IF(!lt, fn->loc, "untyped parameter\n"); - cenv.def((*p)->as<ASymbol*>(), *p, t, new string((*p)->str())); + cenv.def((*p)->as<const ASymbol*>(), *p, t, new string((*p)->str())); } } @@ -235,7 +235,7 @@ CEngine::compileIf(CEnv& cenv, const AIf* aif) Value* varname = new string(cenv.penv.gensymstr("if")); out += (format("%s %s;\n") % *llType(cenv.type(aif)) % *varname).str(); size_t idx = 1; - for (AIf::const_iterator i = aif->begin() + 1; ; ++i, idx += 2) { + for (AIf::const_iterator i = aif->iter_at(1); ; ++i, idx += 2) { AIf::const_iterator next = i; if (++next == aif->end()) break; @@ -252,7 +252,7 @@ CEngine::compileIf(CEnv& cenv, const AIf* aif) // Emit final else block out += "else {\n"; - Value* elseV = llVal(aif->last()->compile(cenv)); + Value* elseV = llVal(aif->list_last()->compile(cenv)); out += (format("%s = %s;\n}\n") % *varname % *elseV).str(); for (size_t i = 1; i < idx / 2; ++i) |