diff options
author | David Robillard <d@drobilla.net> | 2010-08-20 01:58:26 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-08-20 01:58:26 +0000 |
commit | 4861eb2317df37c83415debf65480249002f4180 (patch) | |
tree | 31da803fc9ec29f657587a7539636fda6307a567 /src/compile.cpp | |
parent | 594370a2a381545aea8d0631a86f422f84ee2792 (diff) | |
download | resp-4861eb2317df37c83415debf65480249002f4180.tar.gz resp-4861eb2317df37c83415debf65480249002f4180.tar.bz2 resp-4861eb2317df37c83415debf65480249002f4180.zip |
Make AST::compile const and make Module compilation API take const AST*.
git-svn-id: http://svn.drobilla.net/resp/resp@265 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/compile.cpp')
-rw-r--r-- | src/compile.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/compile.cpp b/src/compile.cpp index 31fa889..7a875f3 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -24,7 +24,7 @@ using namespace std; #define COMPILE_LITERAL(CT) \ -template<> CVal ALiteral<CT>::compile(CEnv& cenv) throw() { \ +template<> CVal ALiteral<CT>::compile(CEnv& cenv) const throw() { \ return cenv.engine()->compileLiteral(cenv, this); \ } COMPILE_LITERAL(int32_t); @@ -32,25 +32,25 @@ COMPILE_LITERAL(float); COMPILE_LITERAL(bool); CVal -AString::compile(CEnv& cenv) throw() +AString::compile(CEnv& cenv) const throw() { return cenv.engine()->compileString(cenv, c_str()); } CVal -AQuote::compile(CEnv& cenv) throw() +AQuote::compile(CEnv& cenv) const throw() { return (*(begin() + 1))->compile(cenv); } CVal -ALexeme::compile(CEnv& cenv) throw() +ALexeme::compile(CEnv& cenv) const throw() { return cenv.engine()->compileString(cenv, c_str()); } CVal -ASymbol::compile(CEnv& cenv) throw() +ASymbol::compile(CEnv& cenv) const throw() { if (cenv.vals.topLevel(this) && cenv.type(this)->head()->str() != "Fn") { return cenv.engine()->getGlobal(cenv, cppstr, *cenv.vals.ref(this)); @@ -60,7 +60,7 @@ ASymbol::compile(CEnv& cenv) throw() } CVal -AFn::compile(CEnv& cenv) throw() +AFn::compile(CEnv& cenv) const throw() { const AType* type = cenv.type(this); CFunc f = cenv.findImpl(this, type); @@ -73,7 +73,7 @@ AFn::compile(CEnv& cenv) throw() } CVal -ACall::compile(CEnv& cenv) throw() +ACall::compile(CEnv& cenv) const throw() { CFunc f = (*begin())->compile(cenv); @@ -88,7 +88,7 @@ ACall::compile(CEnv& cenv) throw() } CVal -ADef::compile(CEnv& cenv) throw() +ADef::compile(CEnv& cenv) const throw() { cenv.def(sym(), body(), cenv.type(body()), NULL); // define stub first for recursion CVal val = body()->compile(cenv); @@ -102,13 +102,13 @@ ADef::compile(CEnv& cenv) throw() } CVal -AIf::compile(CEnv& cenv) throw() +AIf::compile(CEnv& cenv) const throw() { return cenv.engine()->compileIf(cenv, this); } CVal -ACons::compile(CEnv& cenv) throw() +ACons::compile(CEnv& cenv) const throw() { const AType* type = cenv.type(this); vector<CVal> fields; @@ -118,7 +118,7 @@ ACons::compile(CEnv& cenv) throw() } CVal -ATuple::compile(CEnv& cenv) throw() +ATuple::compile(CEnv& cenv) const throw() { const AType* type = cenv.type(this); vector<CVal> fields; @@ -128,7 +128,7 @@ ATuple::compile(CEnv& cenv) throw() } CVal -ADot::compile(CEnv& cenv) throw() +ADot::compile(CEnv& cenv) const throw() { const_iterator i = begin(); AST* tup = *++i; @@ -138,7 +138,7 @@ ADot::compile(CEnv& cenv) throw() } CVal -APrimitive::compile(CEnv& cenv) throw() +APrimitive::compile(CEnv& cenv) const throw() { return cenv.engine()->compilePrimitive(cenv, this); } |