There can also be return statements within loops as well as "break to label" or "continue to label". It all seems very messy to me and I still think it should be behind an optimization option. The current implementation works perfectly and I would prefer the JS output to be minimally different from the AS input, which makes debugging easier.
Array.isArray() is the correct way to test if something is an Array, btw. On Mon, May 9, 2016 at 1:12 PM, Alex Harui <aha...@adobe.com> wrote: > > > On 5/9/16, 9:37 AM, "Josh Tynjala" <joshtynj...@gmail.com> wrote: > > >We might be able to figure out how to use Array.some() instead. Return > >false for most iterations of the loop, and then return true when a "break" > >is encountered (and return false when "continue" is encountered). > >Replacing break and continue could be tricky, though, since they are > >handled in a different sub-emitter. > > Possible. Testing needs to be done to make sure that these patterns > perform better since they introduce a function call and maybe some scoping > issues. > > It may also be that some future version of the compiler generates > different patterns if it knows there is no early exit from the loop. > > -Alex > >