From bf0d7b7add98f976592c9766273ecc84f8b0b6b9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 16 Oct 2009 03:39:22 +0000 Subject: Make ellipses a new kind (AType::DOTS). git-svn-id: http://svn.drobilla.net/resp/tuplr@238 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/unify.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/unify.cpp') diff --git a/src/unify.cpp b/src/unify.cpp index 1cecfb5..278f3a5 100644 --- a/src/unify.cpp +++ b/src/unify.cpp @@ -129,15 +129,16 @@ unify(const Constraints& constraints) AType::iterator si = s->begin() + 1; AType::iterator ti = t->begin() + 1; for (; si != s->end() && ti != t->end(); ++si, ++ti) { - if ((*si)->str() == "..." || (*ti)->str() == "...") + AType* st = (*si)->as(); + AType* tt = (*ti)->as(); + if (st->kind == AType::DOTS || tt->kind == AType::DOTS) return unify(cp); - AType* st = (*si)->to(); - AType* tt = (*ti)->to(); - assert(st && tt); - cp.push_back(Constraint(st, tt, st->loc)); + else + cp.push_back(Constraint(st, tt, st->loc)); } if (si == s->end() && ti == t->end() - || (*ti)->str() == "..." || (*si)->str() == "...") + || (*ti)->as()->kind == AType::DOTS + || (*si)->as()->kind == AType::DOTS) return unify(cp); } throw Error(s->loc ? s->loc : t->loc, -- cgit v1.2.1