aboutsummaryrefslogtreecommitdiffstats
path: root/src/constrain.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-04 23:21:09 +0000
committerDavid Robillard <d@drobilla.net>2010-12-04 23:21:09 +0000
commit8905a0e25858a047e0844c55ed8a025153ab25d9 (patch)
tree1ba8ae460e27d3c8f91db2178073e56ec1534dd5 /src/constrain.cpp
parent1f488a7bd89d4cef07bd41ab22a290b0e230172d (diff)
downloadresp-8905a0e25858a047e0844c55ed8a025153ab25d9.tar.gz
resp-8905a0e25858a047e0844c55ed8a025153ab25d9.tar.bz2
resp-8905a0e25858a047e0844c55ed8a025153ab25d9.zip
More const-correctness (remove all use of const_cast).
git-svn-id: http://svn.drobilla.net/resp/resp@297 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/constrain.cpp')
-rw-r--r--src/constrain.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/constrain.cpp b/src/constrain.cpp
index 410df87..e151eb6 100644
--- a/src/constrain.cpp
+++ b/src/constrain.cpp
@@ -48,7 +48,7 @@ constrain_fn(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
defs.insert(sym);
const AType* tvar = tenv.fresh(sym);
frame.push_back(make_pair(sym, tvar));
- protT.push_back(const_cast<AType*>(tvar));
+ protT.push_back(tvar);
}
protT.head->loc = call->loc;
@@ -115,11 +115,11 @@ constrain_def_type(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
const ATuple* exp = (*i)->as_tuple();
const ASymbol* tag = (*exp->begin())->as_symbol();
TList consT;
- consT.push_back(new AType(const_cast<ASymbol*>(sym), AType::NAME));
+ consT.push_back(new AType(sym, AType::NAME));
for (ATuple::const_iterator i = exp->begin(); i != exp->end(); ++i) {
const ASymbol* sym = (*i)->to_symbol();
THROW_IF(!sym, (*i)->loc, "type expression element is not a symbol");
- consT.push_back(new AType(const_cast<ASymbol*>(sym), AType::NAME));
+ consT.push_back(new AType(sym, AType::NAME));
}
consT.head->loc = exp->loc;
type.push_back(consT);
@@ -147,7 +147,7 @@ constrain_match(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
if (!matcheeT) {
const AType* headT = consT->head()->as_type();
- matcheeT = tup<AType>(call->loc, const_cast<AType*>(headT), 0);
+ matcheeT = new AType(headT, 0, call->loc);
}
THROW_IF(i == call->end(), pattern->loc, "missing pattern body");
@@ -193,7 +193,7 @@ constrain_cons(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
if (sym->cppstr == "Tup") {
TList tupT(new AType(tenv.Tup, NULL, call->loc));
for (ATuple::const_iterator i = call->iter_at(1); i != call->end(); ++i) {
- tupT.push_back(const_cast<AType*>(tenv.var(*i)));
+ tupT.push_back(tenv.var(*i));
}
type = tupT;
} else {
@@ -201,7 +201,7 @@ constrain_cons(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
THROW_IF(!consTRef, call->loc,
(format("call to undefined constructor `%1%'") % sym->cppstr).str());
const AType* consT = *consTRef;
- type = tup<AType>(call->loc, const_cast<AType*>(consT->head()->as_type()), 0);
+ type = new AType(consT->head()->as_type(), 0, call->loc);
}
c.constrain(tenv, call, type);
}
@@ -223,8 +223,8 @@ constrain_dot(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
TList objT(new AType(tenv.Tup, NULL, call->loc));
for (int i = 0; i < idx->val; ++i)
- objT.push_back(const_cast<AType*>(tenv.var()));
- objT.push_back(const_cast<AType*>(retT));
+ objT.push_back(tenv.var());
+ objT.push_back(retT);
objT.push_back(new AType(obj->loc, AType::DOTS));
c.constrain(tenv, obj, objT);
}
@@ -259,7 +259,7 @@ constrain_call(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
const AType* retT = tenv.var(call);
TList argsT;
for (ATuple::const_iterator i = call->iter_at(1); i != call->end(); ++i)
- argsT.push_back(const_cast<AType*>(tenv.var(*i)));
+ argsT.push_back(tenv.var(*i));
argsT.head->loc = call->loc;
c.constrain(tenv, head, tup<AType>(head->loc, tenv.Fn, argsT.head, retT, 0));
c.constrain(tenv, call, retT);