From 9fe6831a3f9f0b9c062f3cd570327bfb828667d9 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Thu, 15 Oct 2009 16:27:11 +0000
Subject: 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
---
 src/constrain.cpp | 8 ++++----
 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)
 {
-- 
cgit v1.2.1