diff options
Diffstat (limited to 'src/c.cpp')
-rw-r--r-- | src/c.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -100,7 +100,7 @@ struct CEngine : public Engine { } CFunc startFunction(CEnv& cenv, - const std::string& name, const ATuple* args, const AType* type) + const std::string& name, const ATuple* args, const AType* type) { const AType* argsT = type->prot()->as_type(); const AType* retT = type->list_ref(2)->as_type(); @@ -130,10 +130,11 @@ struct CEngine : public Engine { f->text += ")\n{\n"; out += f->text; + return f; } - void pushFunctionArgs(CEnv& cenv, const ATuple* fn, const AType* type, CFunc f); + void pushFunctionArgs(CEnv& cenv, const ATuple* prot, const AType* type, CFunc f); void finishFunction(CEnv& cenv, CFunc f, CVal ret) { out += "return " + *(Value*)ret + ";\n}\n\n"; @@ -210,7 +211,7 @@ CEngine::compileString(CEnv& cenv, const char* str) } void -CEngine::pushFunctionArgs(CEnv& cenv, const ATuple* fn, const AType* type, CFunc f) +CEngine::pushFunctionArgs(CEnv& cenv, const ATuple* prot, const AType* type, CFunc f) { cenv.push(); @@ -218,12 +219,12 @@ CEngine::pushFunctionArgs(CEnv& cenv, const ATuple* fn, const AType* type, CFunc // Bind argument values in CEnv vector<Value*> args; - ATuple::const_iterator p = fn->prot()->begin(); + ATuple::const_iterator p = prot->begin(); ATuple::const_iterator pT = argsT->begin(); - for (; p != fn->prot()->end(); ++p, ++pT) { + for (; p != prot->end(); ++p, ++pT) { const AType* t = (*pT)->as_type(); const Type* lt = llType(t); - THROW_IF(!lt, fn->loc, "untyped parameter\n"); + THROW_IF(!lt, (*p)->loc, "untyped parameter\n"); cenv.def((*p)->as_symbol(), *p, t, new string((*p)->str())); } } |