summaryrefslogtreecommitdiff
path: root/src/ast/node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast/node.cpp')
-rw-r--r--src/ast/node.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ast/node.cpp b/src/ast/node.cpp
index dc0a913..c8a3c08 100644
--- a/src/ast/node.cpp
+++ b/src/ast/node.cpp
@@ -356,5 +356,11 @@ void chillAST_Node::gatherScalarVarDecls(vector<chillAST_VarDecl *> &decls) {
}
}
-
+chillAST_Node* chillAST_Node::findContainingStmt() {
+ chillAST_Node* p = getParent();
+ if (p->isCompoundStmt()) return this;
+ if (p->isForStmt()) return this;
+ if (p->isIfStmt()) return this;
+ return p->findContainingStmt();
+}