diff options
Diffstat (limited to 'src/c.cpp')
-rw-r--r-- | src/c.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -154,8 +154,8 @@ struct CEngine : public Engine { CVal compileLiteral(CEnv& cenv, AST* lit); CVal compilePrimitive(CEnv& cenv, APrimitive* prim); CVal compileIf(CEnv& cenv, AIf* aif); - CVal compileGlobal(CEnv& cenv, const AType* type, const string& name, CVal val); - CVal getGlobal(CEnv& cenv, CVal val); + CVal compileGlobal(CEnv& cenv, const AType* type, const string& sym, CVal val); + CVal getGlobal(CEnv& cenv, const string& sym, CVal val); void writeModule(CEnv& cenv, std::ostream& os) { os << out; @@ -202,7 +202,6 @@ CEngine::compileFunction(CEnv& cenv, AFn* fn, const AType* type) { assert(type->concrete()); - CEngine* engine = reinterpret_cast<CEngine*>(cenv.engine()); const AType* argsT = type->prot()->as<const AType*>(); const AType* retT = type->last()->as<const AType*>(); Subst argsSubst = cenv.tenv.buildSubst(type, *argsT); @@ -248,8 +247,7 @@ CEngine::compileFunction(CEnv& cenv, AFn* fn, const AType* type) CVal CEngine::compileIf(CEnv& cenv, AIf* aif) { - CEngine* engine = reinterpret_cast<CEngine*>(cenv.engine()); - Value* varname = new string(cenv.penv.gensymstr("if")); + 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::iterator i = aif->begin() + 1; ; ++i, idx += 2) { @@ -284,11 +282,10 @@ CEngine::compilePrimitive(CEnv& cenv, APrimitive* prim) APrimitive::iterator i = prim->begin(); ++i; - CEngine* engine = reinterpret_cast<CEngine*>(cenv.engine()); - Value* a = llVal((*i++)->compile(cenv)); - Value* b = llVal((*i++)->compile(cenv)); - const string n = prim->head()->to<ASymbol*>()->str(); - string op = n; + Value* a = llVal((*i++)->compile(cenv)); + Value* b = llVal((*i++)->compile(cenv)); + const string n = prim->head()->to<ASymbol*>()->str(); + string op = n; // Convert operator to C operator if they don't match if (n == "=") op = "=="; @@ -310,13 +307,13 @@ CEngine::compilePrimitive(CEnv& cenv, APrimitive* prim) } CVal -CEngine::compileGlobal(CEnv& cenv, const AType* type, const string& name, CVal val) +CEngine::compileGlobal(CEnv& cenv, const AType* type, const string& sym, CVal val) { return NULL; } CVal -CEngine::getGlobal(CEnv& cenv, CVal val) +CEngine::getGlobal(CEnv& cenv, const string& sym, CVal val) { return NULL; } |