diff options
Diffstat (limited to 'src/resp.hpp')
-rw-r--r-- | src/resp.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/resp.hpp b/src/resp.hpp index 494241b..e572473 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -739,6 +739,20 @@ struct CEnv { return tenv.named(type->as_symbol()->sym()); return type; } + const ATuple* typedReplace(const ATuple* in, const AST* from, const AST* to) { + List copy; + FOREACHP(ATuple::const_iterator, i, in) { + if (*i == from) { + copy.push_back(to); + } else { + const ATuple* tup = (*i)->to_tuple(); + copy.push_back(tup ? typedReplace(tup, from, to) : (*i)); + } + } + copy.head->loc = in->loc; + setTypeSameAs(copy.head, in); + return copy; + } const AST* type(const AST* ast, const Subst& subst = Subst(), bool resolve=true) const { const AST* ret = NULL; const ASymbol* sym = ast->to_symbol(); |