aboutsummaryrefslogtreecommitdiffstats
path: root/tuplr.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'tuplr.hpp')
-rw-r--r--tuplr.hpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tuplr.hpp b/tuplr.hpp
index 093f95c..a1bae51 100644
--- a/tuplr.hpp
+++ b/tuplr.hpp
@@ -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"); }
};