057426eb7f
Some scopes that are capturable by closures are not getting marked as such. Instead the parent scope (e.g. the enclosing member) is being treated as the captured scope that owns all the variable declarations down to the closure. The scopes are then being shared across different closures and variables with the same name are able to be overwritten. This bug occurs for any block that isn't a loop or function (i.e. raw blocks, if blocks, try blocks). Loops are correctly handled as defining a scope and therefore those already work correctly. Note: This may cause some small code size increase. There may now be extra assignements reseting capture boxes in more scopes. Bug: https://github.com/dart-lang/sdk/issues/59843 Change-Id: Ic5009188795daabc1544f703fbeca01c0f1951d9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403263 Commit-Queue: Nate Biggs <natebiggs@google.com> Reviewed-by: Stephen Adams <sra@google.com>