Internals: Move iterators to AstNVisitor to avoid null this.

This commit is contained in:
Wilson Snyder
2018-05-10 20:55:37 -04:00
parent 489f58011b
commit 05db8ce6c8
71 changed files with 1145 additions and 1099 deletions
+6 -6
View File
@@ -80,7 +80,7 @@ private:
UINFO(4," MOD "<<nodep<<endl);
m_modp = nodep;
m_deepNum = 0;
nodep->iterateChildren(*this);
iterateChildren(nodep);
m_modp = NULL;
}
virtual void visit(AstCFunc* nodep) {
@@ -90,7 +90,7 @@ private:
{
m_depth = 0;
m_funcp = nodep;
nodep->iterateChildren(*this);
iterateChildren(nodep);
}
m_depth = lastDepth;
m_funcp = lastFuncp;
@@ -103,11 +103,11 @@ private:
AstNode* backp = nodep->backp(); // Only for debug
if (debug()>=9) backp->dumpTree(cout,"- pre : ");
AstCFunc* funcp = createDeepFunc(nodep);
funcp->accept(*this);
iterate(funcp);
if (debug()>=9) backp->dumpTree(cout,"- post: ");
if (debug()>=9) funcp->dumpTree(cout,"- func: ");
} else {
nodep->iterateChildren(*this);
iterateChildren(nodep);
}
m_depth--;
}
@@ -120,7 +120,7 @@ private:
// Default: Just iterate
virtual void visit(AstVar* nodep) {} // Don't hit varrefs under vars
virtual void visit(AstNode* nodep) {
nodep->iterateChildren(*this);
iterateChildren(nodep);
}
public:
@@ -129,7 +129,7 @@ public:
m_modp=NULL;
m_depth=0;
//
nodep->accept(*this);
iterate(nodep);
}
virtual ~DepthBlockVisitor() {}
};