diff options
-rw-r--r-- | llvm.cpp | 2 | ||||
-rw-r--r-- | tuplr.hpp | 14 |
2 files changed, 9 insertions, 7 deletions
@@ -281,7 +281,7 @@ CValue ASTCall::compile(CEnv& cenv) { AST* c = maybeLookup(cenv, at(0)); - Function* f = dynamic_cast<Function*>(LLVal(c->compile(cenv))); + Function* f = dynamic_cast<Function*>(LLVal(cenv.compile(c))); if (!f) throw Error("callee failed to compile", exp.loc); vector<Value*> params(size() - 1); @@ -99,13 +99,15 @@ struct CEnv; ///< Compile-Time Environment struct AST { AST(Cursor c=Cursor()) : loc(c) {} virtual ~AST() {} - virtual string str() const = 0; - virtual bool operator==(const AST& o) const = 0; - virtual bool contains(AST* child) const { return false; } - virtual void constrain(TEnv& tenv) const {} - virtual void lift(CEnv& cenv) {} - virtual CValue compile(CEnv& cenv) = 0; + virtual string str() const = 0; + virtual bool operator==(const AST& o) const = 0; + virtual bool contains(const AST* child) const { return false; } + virtual void constrain(TEnv& tenv) const {} + virtual void lift(CEnv& cenv) {} Cursor loc; +private: + friend class CEnv; + virtual CValue compile(CEnv& cenv) = 0; }; /// Literal value |