I don't see any current way to suppress the Language.closure. Without flow-analysis, I'm not sure the compiler can tell. It could guess that the identifier is a parameter, but the parameter variable could be assigned within the function body.
We could add a new directive like @flexjsisclosure or something like that. Thoughts? -Alex On 7/16/17, 10:05 AM, "Harbs" <harbs.li...@gmail.com> wrote: >I figured out the problem. > >org.apache.flex.utils.callLater has the following code: >setTimeout(makeCalls, 0); > >That compiles to: >setTimeout(org.apache.flex.utils.Language.closure(makeCalls, this, >'makeCalls'), 0); > >When Language.closure is called, it messes up the scope of the calls >variable and subsequent calls to makeCalls step on each other. I believe >this is because makeCalls is bound to the package object of the callLater >function. > >Is there any way to prevent rewriting of function calls to >Language.closure? > >If "setTimeout(makeCalls, 0);" is cross-compiled exactly to: >"setTimeout(makeCalls, 0);", it works like I’d expect it to. > >Thanks, >Harbs > >> On Jul 16, 2017, at 3:46 PM, Harbs <harbs.li...@gmail.com> wrote: >> >> Interesting to note: >> >> Adding a number of callLater() calls resulted in only the first one >>being called in JS. I did not try as a SWF. >