aboutsummaryrefslogtreecommitdiffstats
path: root/src/constrain.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-10-15 15:26:49 +0000
committerDavid Robillard <d@drobilla.net>2009-10-15 15:26:49 +0000
commit6942e2f4c1fec87a152eeefa0ed85e169760fa77 (patch)
tree2ca737bd894d86023904b607f1b8a9136299d84a /src/constrain.cpp
parent81df782cba422300b4034ccd5e48145c09cd0f69 (diff)
downloadresp-6942e2f4c1fec87a152eeefa0ed85e169760fa77.tar.gz
resp-6942e2f4c1fec87a152eeefa0ed85e169760fa77.tar.bz2
resp-6942e2f4c1fec87a152eeefa0ed85e169760fa77.zip
Make TEnv purely a type environment.
git-svn-id: http://svn.drobilla.net/resp/tuplr@222 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/constrain.cpp')
-rw-r--r--src/constrain.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/constrain.cpp b/src/constrain.cpp
index de07f77..10cb380 100644
--- a/src/constrain.cpp
+++ b/src/constrain.cpp
@@ -42,9 +42,9 @@ AString::constrain(TEnv& tenv, Constraints& c) const
void
ASymbol::constrain(TEnv& tenv, Constraints& c) const
{
- pair<AST*, AType*>* ref = tenv.ref(this);
+ AType** ref = tenv.ref(this);
THROW_IF(!ref, loc, (format("undefined symbol `%1%'") % cppstr).str());
- c.push_back(Constraint(tenv.var(this), ref->second, loc));
+ c.push_back(Constraint(tenv.var(this), *ref, loc));
}
void
@@ -78,7 +78,7 @@ AFn::constrain(TEnv& tenv, Constraints& c) const
(format("duplicate parameter `%1%'") % sym->str()).str());
defs.insert(sym);
AType* tvar = tenv.fresh(sym);
- frame.push_back(make_pair(sym, make_pair((AST*)(*i), tvar)));
+ frame.push_back(make_pair(sym, tvar));
protT->push_back(tvar);
}
c.push_back(Constraint(tenv.var(at(1)), protT, at(1)->loc));
@@ -93,8 +93,7 @@ AFn::constrain(TEnv& tenv, Constraints& c) const
THROW_IF(defs.count(sym) != 0, def->loc,
(format("`%1%' defined twice") % sym->str()).str());
defs.insert(def->sym());
- frame.push_back(make_pair(def->sym(),
- make_pair(const_cast<AST*>(def->at(2)), (AType*)NULL)));
+ frame.push_back(make_pair(def->sym(), (AType*)NULL));
}
}
@@ -156,7 +155,7 @@ ADef::constrain(TEnv& tenv, Constraints& c) const
THROW_IF(!sym, loc, "`def' has no symbol")
AType* tvar = tenv.var(at(2));
- tenv.def(sym, make_pair(const_cast<AST*>(at(2)), tvar));
+ tenv.def(sym, tvar);
at(2)->constrain(tenv, c);
c.constrain(tenv, at(1), tvar);
c.constrain(tenv, this, tenv.named("Nothing"));