summaryrefslogtreecommitdiff
path: root/src/ast/node.cpp
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2016-10-02 14:10:10 -0600
committerTuowen Zhao <ztuowen@gmail.com>2016-10-02 14:10:10 -0600
commitd2176835fc6e497a6c3e19b4630745c3911bde2c (patch)
treead4b207876c32f80dc62ccce47cf99458d8a2e5e /src/ast/node.cpp
parentdb3ff28ba74ff76aaac9e73d1b208e17992864cb (diff)
downloadchill-d2176835fc6e497a6c3e19b4630745c3911bde2c.tar.gz
chill-d2176835fc6e497a6c3e19b4630745c3911bde2c.tar.bz2
chill-d2176835fc6e497a6c3e19b4630745c3911bde2c.zip
fixes
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();
+}