Hoist variables properly when rewriting for-loop initializers.
When for loops contain multiple initializers, we rewrite them,
migrating the initializer statements out of the for-statement and
wrapping the statement in an enclosing braced block:
{
init-stmt;
for (; test=expr; next-expr) {
...
}
}
Previously, we did not actually create a symbol table for this
braced block; we just stole the for-statement's symbol table.
We now properly hoist the symbols associated with the variables
that we moved into the newly-created braced-block's symbol table.
Change-Id: I46445a2c203ee1d64c9e58877601743bb5bfca5d
Bug: b/320478438
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/801977
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
4 files changed