From bcc1bc3a8c648daa059daf832ac04ad907c58129 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 29 Jun 2009 06:38:59 +0000 Subject: Tidy. git-svn-id: http://svn.drobilla.net/resp/tuplr@169 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/parse.cpp | 6 ++---- src/unify.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/parse.cpp b/src/parse.cpp index c557c66..e37f095 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -74,10 +74,8 @@ parseLiteral(PEnv& penv, const SExp& exp, void* arg) inline AST* parseFn(PEnv& penv, const SExp& exp, void* arg) { - if (exp.size() < 2) - throw Error(exp.loc, "Missing function parameters and body"); - else if (exp.size() < 3) - throw Error(exp.loc, "Missing function body"); + THROW_IF(exp.size() < 2,exp.loc, "Missing function parameters and body"); + THROW_IF(exp.size() < 3, exp.loc, "Missing function body"); SExp::const_iterator a = exp.begin(); ++a; AFn* ret = tup(exp.loc, penv.sym("fn"), new ATuple(penv.parseTuple(*a++)), 0); while (a != exp.end()) diff --git a/src/unify.cpp b/src/unify.cpp index d2bd055..864ea81 100644 --- a/src/unify.cpp +++ b/src/unify.cpp @@ -89,11 +89,12 @@ unify(const Constraints& constraints) cp.replace(t, s); return Subst::compose(unify(cp), Subst(t, s)); } else if (s->kind == AType::EXPR && s->kind == t->kind && s->size() == t->size()) { - for (size_t i = 0; i < s->size(); ++i) { + assert(*s->at(0)->to() == *t->at(0)->to()); + for (size_t i = 1; i < s->size(); ++i) { AType* si = s->at(i)->to(); AType* ti = t->at(i)->to(); - if (si && ti) - cp.push_back(Constraint(si, ti, si->loc)); + assert(si && ti); + cp.push_back(Constraint(si, ti, si->loc)); } return unify(cp); } else { -- cgit v1.2.1