diff options
Diffstat (limited to 'src/unify.cpp')
-rw-r--r-- | src/unify.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/unify.cpp b/src/unify.cpp index ec5aa9a..51179d9 100644 --- a/src/unify.cpp +++ b/src/unify.cpp @@ -31,19 +31,19 @@ TEnv::buildSubst(const AType* genericT, const AType& argsT) Subst subst; // Build substitution to apply to generic type - const ATuple* genericProtT = genericT->list_ref(1)->as<const ATuple*>(); + const ATuple* genericProtT = genericT->list_ref(1)->as_tuple(); ATuple::const_iterator g = genericProtT->begin(); AType::const_iterator a = argsT.begin(); for (; a != argsT.end(); ++a, ++g) { - const AType* genericArgT = (*g)->to<const AType*>(); - const AType* callArgT = (*a)->to<const AType*>(); + const AType* genericArgT = (*g)->to_type(); + const AType* callArgT = (*a)->to_type(); if (callArgT->kind == AType::EXPR) { assert(genericArgT->kind == AType::EXPR); ATuple::const_iterator gi = genericArgT->begin(); ATuple::const_iterator ci = callArgT->begin(); for (; gi != genericArgT->end(); ++gi, ++ci) { - const AType* gT = (*gi)->to<const AType*>(); - const AType* aT = (*ci)->to<const AType*>(); + const AType* gT = (*gi)->to_type(); + const AType* aT = (*ci)->to_type(); if (gT && aT) subst.add(gT, aT); } @@ -60,7 +60,7 @@ Constraints::constrain(TEnv& tenv, const AST* o, const AType* t) { assert(o); assert(t); - assert(!o->to<const AType*>()); + assert(!o->to_type()); push_back(Constraint(tenv.var(o), t)); } @@ -75,13 +75,13 @@ substitute(const AType* tup, const AType* from, const AType* to) type->loc = (*i)->loc; ret.push_back(type); } else if (*i != to) { - const AType* elem = (*i)->as<const AType*>(); + const AType* elem = (*i)->as_type(); if (elem->kind == AType::EXPR) ret.push_back(const_cast<AType*>(substitute(elem, from, to))); else ret.push_back(const_cast<AType*>(elem)); } else { - ret.push_back(const_cast<AType*>((*i)->as<const AType*>())); + ret.push_back(const_cast<AType*>((*i)->as_type())); } } return ret.head; @@ -148,15 +148,15 @@ unify(const Constraints& constraints) AType::const_iterator si = s->begin(); AType::const_iterator ti = t->begin(); for (; si != s->end() && ti != t->end(); ++si, ++ti) { - const AType* st = (*si)->as<const AType*>(); - const AType* tt = (*ti)->as<const AType*>(); + const AType* st = (*si)->as_type(); + const AType* tt = (*ti)->as_type(); if (st->kind == AType::DOTS || tt->kind == AType::DOTS) return unify(cp); else cp.push_back(Constraint(st, tt)); } - if ( (si == s->end() && (ti == t->end() || (*ti)->as<const AType*>()->kind == AType::DOTS)) - || (ti == t->end() && (*si)->as<const AType*>()->kind == AType::DOTS)) + if ( (si == s->end() && (ti == t->end() || (*ti)->as_type()->kind == AType::DOTS)) + || (ti == t->end() && (*si)->as_type()->kind == AType::DOTS)) return unify(cp); } throw Error(s->loc, |