diff options
author | David Robillard <d@drobilla.net> | 2009-10-15 16:27:11 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-10-15 16:27:11 +0000 |
commit | 9fe6831a3f9f0b9c062f3cd570327bfb828667d9 (patch) | |
tree | f6eff3b4f00a4615bb6f1be6699466de65cfc381 | |
parent | d4b45062903586e86daed7d1f319df6b2133644b (diff) | |
download | resp-9fe6831a3f9f0b9c062f3cd570327bfb828667d9.tar.gz resp-9fe6831a3f9f0b9c062f3cd570327bfb828667d9.tar.bz2 resp-9fe6831a3f9f0b9c062f3cd570327bfb828667d9.zip |
Always use error-checking (and terser) Constraints::constrain over push_back.
git-svn-id: http://svn.drobilla.net/resp/tuplr@225 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r-- | src/constrain.cpp | 8 | ||||
-rw-r--r-- | src/unify.cpp | 1 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/constrain.cpp b/src/constrain.cpp index 10cb380..97af0af 100644 --- a/src/constrain.cpp +++ b/src/constrain.cpp @@ -36,7 +36,7 @@ CONSTRAIN_LITERAL(bool, "Bool") void AString::constrain(TEnv& tenv, Constraints& c) const { - c.push_back(Constraint(tenv.var(this), tenv.named("String"), loc)); + c.constrain(tenv, this, tenv.named("String")); } void @@ -44,7 +44,7 @@ ASymbol::constrain(TEnv& tenv, Constraints& c) const { AType** ref = tenv.ref(this); THROW_IF(!ref, loc, (format("undefined symbol `%1%'") % cppstr).str()); - c.push_back(Constraint(tenv.var(this), *ref, loc)); + c.constrain(tenv, this, *ref); } void @@ -55,7 +55,7 @@ ATuple::constrain(TEnv& tenv, Constraints& c) const (*p)->constrain(tenv, c); t->push_back(tenv.var(*p)); } - c.push_back(Constraint(tenv.var(this), t, loc)); + c.constrain(tenv, this, t); } void @@ -81,7 +81,7 @@ AFn::constrain(TEnv& tenv, Constraints& c) const frame.push_back(make_pair(sym, tvar)); protT->push_back(tvar); } - c.push_back(Constraint(tenv.var(at(1)), protT, at(1)->loc)); + c.constrain(tenv, at(1), protT); // Add internal definitions to environment frame size_t e = 2; diff --git a/src/unify.cpp b/src/unify.cpp index 8aac926..38f2583 100644 --- a/src/unify.cpp +++ b/src/unify.cpp @@ -55,7 +55,6 @@ TEnv::buildSubst(AType* genericT, const AType& argsT) return subst; } - void Constraints::constrain(TEnv& tenv, const AST* o, AType* t) { |