HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.2k stars 658 forks source link

Copy var flags when duplicating local variables #11803

Closed Simn closed 4 weeks ago

Simn commented 4 weeks ago

This is a pretty bad oversight which might cause all sorts of issues, so we might want to pull it onto the 4.3 branch as well.

As fallout, we now hoist static locals inside unrollable loops in order to avoid duplicate declarations. Looking at this makes we wonder if we shouldn't always hoist local declarations in these cases to avoid declaring multiple variables unnecessarily.

Simn commented 4 weeks ago

Turns out doing this for non-statics isn't so easy because of local functions and threads, so let's not do this after all. I still did some related cleanup, so this should be good regardless.