Have WalkAST postorder callback function return an ASTNode *
In general, it should just return the original node pointer, but for type checking and optimization passes, it can return a new value for the node (that will be assigned where the old one was in the tree.) Along the way, fixed some bugs in WalkAST() where the postorder callback wouldn't end up being called for a few expr types (sizeof, dereference, address of, reference).
This commit is contained in:
4
stmt.cpp
4
stmt.cpp
@@ -997,12 +997,12 @@ lVaryingBCPreFunc(ASTNode *node, void *d) {
|
||||
/** Postorder callback function for checking for varying breaks or
|
||||
continues; decrement the varying control flow depth after the node's
|
||||
children have been processed, if this is a varying if statement. */
|
||||
static bool
|
||||
static ASTNode *
|
||||
lVaryingBCPostFunc(ASTNode *node, void *d) {
|
||||
VaryingBCCheckInfo *info = (VaryingBCCheckInfo *)d;
|
||||
if (lIsVaryingFor(node))
|
||||
--info->varyingControlFlowDepth;
|
||||
return true;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user