binaryen
binaryen copied to clipboard
Add a ControlChildIterator to parallel ValueChildIterator
Maybe we can add a ControlChildIterator to parallel ValueChildIterator, that iterates on control flow children, and use that here? It would avoid us needing to update this code each time we add or modify a control flow structure (i.e. it would keep that logic in `iterator.h`.
I mean, in the code here, we could have:
for (auto* child : ControlChildIterator(curr)) {
this->addUniqueSymbol();
Super::walk(child);
}
However that won't work for block, I guess... so we need some special casing here anyhow. Maybe it's not worth it then.
Another option might be BlockChildIterator
or such, as what we look for here is a child that is a new block scope..?
Originally posted by @kripken in https://github.com/WebAssembly/binaryen/pull/5772#discussion_r1247115668