BowlerHatLLC / vscode-as3mxml

ActionScript & MXML language extension for Visual Studio Code. Develop apps for Adobe AIR, Adobe Flash Player, or Apache Royale.
https://as3mxml.com/
Apache License 2.0
256 stars 39 forks source link

asformat: Bug in switch command within loop #747

Open esidegallery opened 4 months ago

esidegallery commented 4 months ago

Initially discovered when the loop was named, but happens even with unnamed loops:

Animation

EDIT: Looks like this happens in switch statements within loops whether continue statement used or not:

Animation

joshtynjala commented 4 months ago

Thanks! I'll take a look.

joshtynjala commented 1 month ago

Adding the code from from the second .gif, for easy copy/paste.

package
{
    public class Temp
    {
        public function test():void
        {
            for each (var item:Object in [])
            {
                switch (true)
                {
                    case 1:
                        var foo:int;
                        break;
                    case 2:
                        var bar:int;
                        break;
                }
            }
        }
    }
}
joshtynjala commented 1 month ago

I can reproduce with both for-each and for-in loops. I cannot reproduce with regular for loops, while loops, nor if conditionals.

joshtynjala commented 1 month ago

apache/royale-compiler@427d542518381c64eb23c1554d21dada53c5da2b