diff options
Diffstat (limited to 'tuplr.hpp')
-rw-r--r-- | tuplr.hpp | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -151,7 +151,13 @@ struct ASTTuple : public AST, public vector<AST*> { FOREACH(iterator, t, *this) (*t)->lift(cenv); } - bool contains(AST* child) const; + bool contains(AST* child) const { + if (*this == *child) return true; + FOREACH(const_iterator, p, *this) + if (**p == *child || (*p)->contains(child)) + return true; + return false; + } void constrain(TEnv& tenv) const; CValue compile(CEnv& cenv) { throw Error("tuple compiled"); } }; |