I implemented a "debugger" statement in ActionScript that works similarly
to the JavaScript debugger statement:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger

In JavaScript, it translates directly. In SWF, the compiler generates
bytecode for a call to flash.debugger.enterDebugger(). This is not an
officially documented function in the Flash runtimes, but it's been around
since AS3 was introduced, as far as I can tell. I would say that it's
unlikely to be removed in the future. While I mentioned that I was
considering using flash.system.System.pause(), it did not behave in the way
that I originally hoped. In my tests, System.pause() seemed to pause
rendering only, and code kept running without triggering the debugger.

My changes are in the feature/debugger-statement branch of flex-falcon.
I'll be happy to merge them into develop, if there's interest.

- Josh



On Tue, Jul 18, 2017 at 5:05 PM, Josh Tynjala <joshtynj...@gmail.com> wrote:

> I'm working on adding support for the debugger statement to the compiler
> (FLEX-35343). I can successfully emit the debugger statement in the
> generated JS so far.
>
> I'm not yet sure if I can make it work on the SWF side. I figured out
> where I can generate bytecode instructions in ABCGeneratingReducer. If I
> can figure out how to generate bytecode to call enterDebugger() (or
> whatever the function is called), the debugger statement will work in both
> SWF and JS.
>
> - Josh
>
> On Sun, Jul 16, 2017 at 9:22 AM, Josh Tynjala <joshtynj...@gmail.com>
> wrote:
>
>> If it were a variable or function, it could be defined somewhere like
>> that. It's a statement, though, so it needs to be added to where Falcon
>> creates the AST from the ActionScript code. Then, it also needs to emit the
>> statement as JS in FalconJX. On the SWF side, it should be translated to
>> appropriate bytecode to call enterDebugger().
>>
>> - Josh
>>
>> On Jul 16, 2017 8:56 AM, "Harbs" <harbs.li...@gmail.com> wrote:
>>
>>> What needs to be modified? Does it need to be added to NativeJSType
>>> enums? Somewhere else?
>>>
>>> I’m really not clear on when things to be added to that and when they
>>> need to be in typedefs.
>>>
>>> > On Jul 16, 2017, at 6:51 PM, Harbs <harbs.li...@gmail.com> wrote:
>>> >
>>> >> The compiler needs to be modified to support the debugger statement.
>>>
>>>
>

Reply via email to