Hmm, after digging into it a bit more, it appears that optimization does not remove trace calls. I haven't dumped a release SWF to verify. Maybe trace() just doesn't do anything in the production player.
Optimization is a post-link process. IOW, it processes ABC code instead of source code, so no conditional compile directives are available. There are flags for doing various optimizations. To remove debugging code, I think you'd just add another flag and figure out how to manipulate the ABC code. There is a DeadCodeFilter that looks like it does serious rework of the ABC that might be a good example to follow. HTH, -Alex On 7/20/17, 6:21 AM, "Josh Tynjala" <joshtynj...@gmail.com> wrote: >We could consider something similar to COMPILE::JS and COMPILE::SWF where >they default to a value of auto, which the compiler knows to turn into >true >or false. COMPILE::DEBUG could also default to a value of auto, and then >the compiler makes it true for a debug build and false for a release >build. > >- Josh > >On Thu, Jul 20, 2017 at 12:55 AM, Harbs <harbs.li...@gmail.com> wrote: > >> Cool. So what would you recommend the convention to tell the compiler to >> do so? A meta tag? a comment directive? (i.e. @debug) >> >> > On Jul 20, 2017, at 10:51 AM, Alex Harui <aha...@adobe.com.INVALID> >> wrote: >> > >> > I believe there is code that becomes part of the optimizer.jar that >> > removes the trace statements. It might be possible extend that code >>to >> > remove other things. >> > >> > -Alex >> > >> > On 7/19/17, 11:47 PM, "Harbs" <harbs.li...@gmail.com> wrote: >> > >> >> I don’t think there were any responses to this. >> >> >> >> As it stands, the debugging functions will exist in release versions >>of >> >> swfs. >> >> >> >> Harbs >> >> >> >>> On Jul 16, 2017, at 12:07 PM, Harbs <harbs.li...@gmail.com> wrote: >> >>> >> >>> 1. The debugging functions should disappear in a release build of >>JS, >> >>> but I’m not sure how to make the same thing happen in a release >>build >> of >> >>> SWF. I don’t think a debug config is the solution, because the debug >> >>> statements should be preserved in framework code and only be >>stripped >> >>> out for application release builds. Does anyone have ideas on how >>to go >> >>> about doing that? >> >> >> > >> >>