diff options
author | David Robillard <d@drobilla.net> | 2010-12-26 17:37:26 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-26 17:37:26 +0000 |
commit | 1e3f0e31b86b27af0f89bf48281673e6b15ea799 (patch) | |
tree | d9017600436e2a55cbe8bf13c354ee268d1fa8f7 | |
parent | 99ce17067db15d7d5c470ece4550f14b7315ad39 (diff) | |
download | resp-1e3f0e31b86b27af0f89bf48281673e6b15ea799.tar.gz resp-1e3f0e31b86b27af0f89bf48281673e6b15ea799.tar.bz2 resp-1e3f0e31b86b27af0f89bf48281673e6b15ea799.zip |
Begin killing AType.
git-svn-id: http://svn.drobilla.net/resp/resp@353 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r-- | src/resp.hpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/resp.hpp b/src/resp.hpp index 7820d28..197a60b 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -364,26 +364,26 @@ struct AType : public ATuple { tag(T_TYPE); loc = cur; } - - bool concrete() const { - switch (kind) { - case VAR: return false; - case NAME: return false; - case PRIM: return head()->str() != "Nothing"; - case EXPR: - FOREACHP(const_iterator, t, this) { - const AType* kid = (*t)->to_type(); - if (kid && !kid->concrete()) - return false; - } - case DOTS: return false; - } - return true; - } Kind kind; unsigned id; }; +static bool concrete_type(const AType* type) { + switch (type->kind) { + case AType::VAR: return false; + case AType::NAME: return false; + case AType::PRIM: return type->head()->str() != "Nothing"; + case AType::EXPR: + FOREACHP(AType::const_iterator, t, type) { + const AType* kid = (*t)->to_type(); + if (kid && !concrete_type(kid)) + return false; + } + case AType::DOTS: return false; + } + return true; +} + // Utility class for easily building lists from left to right template<typename CT, typename ET> // ConsType, ElementType struct List { @@ -608,7 +608,7 @@ struct Subst : public list<Constraint> { const_iterator i = find(in); if (i != end()) { const AType* out = i->second->as_type(); - if (out->kind == AType::EXPR && !out->concrete()) + if (out->kind == AType::EXPR && !concrete_type(out)) out = apply(out->as_type()); return out; } else { |