aboutsummaryrefslogtreecommitdiffstats
path: root/src/unify.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-10-16 03:39:22 +0000
committerDavid Robillard <d@drobilla.net>2009-10-16 03:39:22 +0000
commitbf0d7b7add98f976592c9766273ecc84f8b0b6b9 (patch)
tree6e440e3496bdc32b16bad029c0513c13f280bdab /src/unify.cpp
parent2f42cbc0483c437632dd810111964600bbdb900c (diff)
downloadresp-bf0d7b7add98f976592c9766273ecc84f8b0b6b9.tar.gz
resp-bf0d7b7add98f976592c9766273ecc84f8b0b6b9.tar.bz2
resp-bf0d7b7add98f976592c9766273ecc84f8b0b6b9.zip
Make ellipses a new kind (AType::DOTS).
git-svn-id: http://svn.drobilla.net/resp/tuplr@238 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/unify.cpp')
-rw-r--r--src/unify.cpp13
1 files changed, 7 insertions, 6 deletions
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*>();
+ AType* tt = (*ti)->as<AType*>();
+ if (st->kind == AType::DOTS || tt->kind == AType::DOTS)
return unify(cp);
- AType* st = (*si)->to<AType*>();
- AType* tt = (*ti)->to<AType*>();
- 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<AType*>()->kind == AType::DOTS
+ || (*si)->as<AType*>()->kind == AType::DOTS)
return unify(cp);
}
throw Error(s->loc ? s->loc : t->loc,