aboutsummaryrefslogtreecommitdiffstats
path: root/src/lift.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-04 22:54:17 +0000
committerDavid Robillard <d@drobilla.net>2010-12-04 22:54:17 +0000
commit7bbb36a7085576958993cc6c394d5af8455a948d (patch)
tree1fc50659538100ed8ef6602e7c9e1c52acda051f /src/lift.cpp
parent6b063941f02808b5e510f8a9c102b3d361de78f3 (diff)
downloadresp-7bbb36a7085576958993cc6c394d5af8455a948d.tar.gz
resp-7bbb36a7085576958993cc6c394d5af8455a948d.tar.bz2
resp-7bbb36a7085576958993cc6c394d5af8455a948d.zip
Make resp_lift const-correct.
git-svn-id: http://svn.drobilla.net/resp/resp@294 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/lift.cpp')
-rw-r--r--src/lift.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lift.cpp b/src/lift.cpp
index 979f3c1..e98ddc6 100644
--- a/src/lift.cpp
+++ b/src/lift.cpp
@@ -91,8 +91,8 @@ lift_fn(CEnv& cenv, Code& code, ATuple* fn) throw()
// Lift body
const AType* implRetT = NULL;
for (ATuple::const_iterator i = fn->iter_at(2); i != fn->end(); ++i) {
- AST* lifted = resp_lift(cenv, code, const_cast<AST*>(*i));
- impl.push_back(lifted);
+ const AST* lifted = resp_lift(cenv, code, *i);
+ impl.push_back(const_cast<AST*>(lifted));
implRetT = cenv.type(lifted);
}
@@ -142,7 +142,7 @@ lift_call(CEnv& cenv, Code& code, ATuple* call) throw()
// Lift all children (callee and arguments, recursively)
for (ATuple::const_iterator i = call->begin(); i != call->end(); ++i)
- copy.push_back(const_cast<AST*>(resp_lift(cenv, code, const_cast<AST*>(*i))));
+ copy.push_back(const_cast<AST*>(resp_lift(cenv, code, *i)));
copy.head->loc = call->loc;
@@ -197,9 +197,9 @@ lift_def(CEnv& cenv, Code& code, ATuple* def) throw()
assert(def->list_ref(1)->to_symbol());
List<ATuple, AST> copy;
copy.push_back(def->head());
- copy.push_back(resp_lift(cenv, code, const_cast<AST*>(def->list_ref(1))));
+ copy.push_back(const_cast<AST*>(resp_lift(cenv, code, def->list_ref(1))));
for (ATuple::const_iterator t = def->iter_at(2); t != def->end(); ++t)
- copy.push_back(resp_lift(cenv, code, const_cast<AST*>(*t)));
+ copy.push_back(const_cast<AST*>(resp_lift(cenv, code, *t)));
cenv.setTypeSameAs(copy, def);
@@ -221,20 +221,20 @@ lift_builtin_call(CEnv& cenv, Code& code, ATuple* call) throw()
// Lift all arguments
for (ATuple::const_iterator i = call->iter_at(1); i != call->end(); ++i)
- copy.push_back(resp_lift(cenv, code, const_cast<AST*>(*i)));
+ copy.push_back(const_cast<AST*>(resp_lift(cenv, code, *i)));
cenv.setTypeSameAs(copy, call);
return copy;
}
-AST*
-resp_lift(CEnv& cenv, Code& code, AST* ast) throw()
+const AST*
+resp_lift(CEnv& cenv, Code& code, const AST* ast) throw()
{
const ASymbol* const sym = ast->to_symbol();
if (sym)
return lift_symbol(cenv, code, sym);
- ATuple* const call = ast->to_tuple();
+ ATuple* const call = const_cast<ATuple*>(ast->to_tuple());
if (call) {
const ASymbol* const sym = call->head()->to_symbol();
const std::string form = sym ? sym->cppstr : "";