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
+4 -4
View File
@@ -618,11 +618,11 @@ sub tree_base {
if ($out_for_type_sc[0]) { # Short-circuited types
$self->print(" // Generated by astgen with short-circuiting\n",
" virtual void visit(Ast${type}* nodep) {\n",
" nodep->lhsp()->iterateAndNext(*this);\n",
" iterateAndNextNull(nodep->lhsp());\n",
@out_for_type_sc);
$self->print(" nodep->rhsp()->iterateAndNext(*this);\n",
$self->print(" iterateAndNextNull(nodep->rhsp());\n",
" AstNodeTriop *tnp = VN_CAST(nodep, NodeTriop);\n",
" if (tnp && tnp->thsp()) tnp->thsp()->iterateAndNext(*this);\n",
" if (tnp && tnp->thsp()) iterateAndNextNull(tnp->thsp());\n",
@out_for_type,
" }\n") if ($out_for_type[0]);
} elsif ($out_for_type[0]) { # Other types with something to print
@@ -631,7 +631,7 @@ sub tree_base {
$self->print(" // Generated by astgen\n",
" virtual void visit$gen(Ast${type}* nodep) {\n",
($skip?"":
" nodep->iterateChildren(*this);\n"),
" iterateChildren(nodep);\n"),
@out_for_type,
" }\n");
}