Re: [FlexJS] Debugging package

2017-07-25 Thread yishayw
-Debugging-package-tp63288p63541.html Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] Debugging package

2017-07-24 Thread Josh Tynjala
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

Re: [FlexJS] Debugging package

2017-07-20 Thread Alex Harui
It sounds like an interesting challenge, but I would not want to see special cases like this in the compiler. I don't understand the need to extend AS with JS syntax. In general, if there are different implementations on the various runtimes, we should invent an API for everyone to use, such as

Re: [FlexJS] Debugging package

2017-07-20 Thread Josh Tynjala
> > I'm still confused. If you can use flash.system.System.pause() what custom byte code is needed? I want to be able to write a "debugger" statement in ActionScript and have the compiler call flash.system.System.pause() in the generated SWF. Calling a function in a SWF requires some kind of

Re: [FlexJS] Debugging package

2017-07-20 Thread Alex Harui
I'm still confused. If you can use flash.system.System.pause() what custom byte code is needed? Are there other JS statements we need to support some day? Being able to add them to js.swc might be a better plan than having to change the compiler for each statement. -Alex On 7/19/17, 7:37 PM,

Re: [FlexJS] Debugging package

2017-07-20 Thread piotrz
If that's the case we should not so freely use traces in framework itself. Eventually pass in compilation require flag for each module. Piotr - Apache Flex PMC piotrzarzyck...@gmail.com -- View this message in context: http://apache-flex-development.247.n4.nabble.com/FlexJS-Debugging

Re: [FlexJS] Debugging package

2017-07-20 Thread Alex Harui
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

Re: [FlexJS] Debugging package

2017-07-20 Thread Josh Tynjala
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.

Re: [FlexJS] Debugging package

2017-07-20 Thread piotrz
Harbs, It would be great to have it summarized in jira! Thanks, Piotr - Apache Flex PMC piotrzarzyck...@gmail.com -- View this message in context: http://apache-flex-development.247.n4.nabble.com/FlexJS-Debugging-package-tp63288p63453.html Sent from the Apache Flex Development

Re: [FlexJS] Debugging package

2017-07-20 Thread Harbs
We also need to modify the output for trace in JS to put the goog.DEBUG check at the very start of the function and to not output the @export tag. The rest of the debugging functions need to lose the @export tag as well. Should I put all this in a JIRA? > On Jul 20, 2017, at 11:16 AM, Harbs

Re: [FlexJS] Debugging package

2017-07-20 Thread Harbs
Hard code what? For any function in the org.apache.flex.debugging package it would not output to release SWF? > On Jul 20, 2017, at 11:00 AM, Alex Harui wrote: > > For now, I would just hard code it. > > On 7/20/17, 12:55 AM, "Harbs" wrote: >

Re: [FlexJS] Debugging package

2017-07-20 Thread Alex Harui
For now, I would just hard code it. On 7/20/17, 12:55 AM, "Harbs" 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

Re: [FlexJS] Debugging package

2017-07-20 Thread Harbs
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 wrote: > > I believe there is code that becomes part of the optimizer.jar that > removes the trace

Re: [FlexJS] Debugging package

2017-07-20 Thread Alex Harui
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" wrote: >I don’t think there were any responses to this. > >As it stands,

Re: [FlexJS] Debugging package

2017-07-20 Thread Harbs
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 wrote: > > 1. The debugging functions should disappear in a release build of JS, but I’m > not sure

Re: [FlexJS] Debugging package

2017-07-19 Thread Josh Tynjala
Well, as I said, I already have the compiler parsing the real debugger statement in AS, and emitting the right JS. I just need to generate some custom bytecode for SWF and then it will work everywhere. - Josh On Wed, Jul 19, 2017 at 7:17 PM, Alex Harui wrote: > I

Re: [FlexJS] Debugging package

2017-07-19 Thread Alex Harui
I think we allow classes to be used as a "statement" for dependency management. CoreClasses.as, for example, has plenty of lines like: import org.apache.flex.core.IUIBase; IUIBase; HTH, -Alex On 7/19/17, 6:57 PM, "Josh Tynjala" wrote: >Yes, I'm changing the

Re: [FlexJS] Debugging package

2017-07-19 Thread Josh Tynjala
Yes, I'm changing the compiler. The debugger statement is not a function. It works like this: debugger; I think that flash.system.System.pause() will work too, and it's documented: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/System.html#pause() - Josh On

Re: [FlexJS] Debugging package

2017-07-19 Thread Alex Harui
Are you changing the compiler? I thought you could just add: function debugger{}; to missing.js so it results in: public class debugger {}; and package flash.debugger { native function enterDebugger():void; } to one of our swcs? Although I have to say I'm a bit uncomfortable about

Re: [FlexJS] Debugging package

2017-07-18 Thread Josh Tynjala
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

Re: [FlexJS] Avoiding Language.closure (was Re: [FlexJS] Debugging package)

2017-07-17 Thread Alex Harui
"var self = this;” is added to every method that has inner/local functions. Use of "this" in local functions is changed to use "self" in order to get AS scoping in JS. I think we currently generate a self=this even if the local functions don't need it. Someday the compiler will be smarter about

Re: [FlexJS] Avoiding Language.closure (was Re: [FlexJS] Debugging package)

2017-07-17 Thread Harbs
The places that I checked look good. Side question: Despite the fact that “this” is no longer used in the callLater function, I noticed that the compiler is inserting "var self = this;” at the start of the function. I don’t think it causes any harm, but it does cause a Google compiler warning

Re: [FlexJS] Avoiding Language.closure (was Re: [FlexJS] Debugging package)

2017-07-17 Thread Harbs
I’m not going to claim I understand what you just wrote. ;-) I’ll see if I can understand the output… Thanks. > On Jul 17, 2017, at 10:33 PM, Alex Harui wrote: > > Thinking about it more, I think a parameter of type Function never needs > to be wrapped. It would get

Re: [FlexJS] Avoiding Language.closure (was Re: [FlexJS] Debugging package)

2017-07-17 Thread Alex Harui
Thinking about it more, I think a parameter of type Function never needs to be wrapped. It would get wrapped on any assignment in the function body. I just pushed changes to reflect that. -Alex On 7/16/17, 11:41 PM, "Alex Harui" wrote: >Seems reasonable to add a

Re: [FlexJS] Avoiding Language.closure (was Re: [FlexJS] Debugging package)

2017-07-17 Thread Alex Harui
Seems reasonable to add a check to see if the function body is for a static method. -Alex On 7/16/17, 11:25 PM, "Harbs" wrote: >A directive could be a solution. > >But I think this is an issue with any static method. If a closure is used >inside a static method, or a

Re: [FlexJS] Avoiding Language.closure (was Re: [FlexJS] Debugging package)

2017-07-17 Thread Harbs
A directive could be a solution. But I think this is an issue with any static method. If a closure is used inside a static method, or a function declared inside a static method, it should not use Language.closure. FWIW, the Google compile complains about “this” being used in a static method

Re: [FlexJS] Avoiding Language.closure (was Re: [FlexJS] Debugging package)

2017-07-17 Thread Alex Harui
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

[FlexJS] Avoiding Language.closure (was Re: [FlexJS] Debugging package)

2017-07-16 Thread Harbs
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

Re: [FlexJS] Debugging package

2017-07-16 Thread piotrz
-development.247.n4.nabble.com/FlexJS-Debugging-package-tp63288p63313.html Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] Debugging package

2017-07-16 Thread Harbs
That’s beyond me. One day maybe I’ll be up to fiddling with the compiler like that, but I’m not there yet… I’d think nothing needs to be done on the SWF side (unless we need to support debugger; in client code unwrapped). Right now, here’s what I have: COMPILE::SWF {

Re: [FlexJS] Debugging package

2017-07-16 Thread Josh Tynjala
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

Re: [FlexJS] Debugging package

2017-07-16 Thread Harbs
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 wrote: > >> The compiler needs to be modified

Re: [FlexJS] Debugging package

2017-07-16 Thread Harbs
I added flash.debugger.enterDebugger(); on the SWF side. I have not yet tested it, but it’s *supposed* to work… > On Jul 16, 2017, at 6:34 PM, Josh Tynjala wrote: > > The compiler needs to be modified to support the debugger statement. > > Ideally, it would also force

Re: [FlexJS] Debugging package

2017-07-16 Thread Harbs
> > > - > Apache Flex PMC > piotrzarzyck...@gmail.com > -- > View this message in context: > http://apache-flex-development.247.n4.nabble.com/FlexJS-Debugging-package-tp63288p63306.html > Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] Debugging package

2017-07-16 Thread piotrz
Let's create jira for that. I'm surprise that Ant build is not complaining about that. Why? Piotr - Apache Flex PMC piotrzarzyck...@gmail.com -- View this message in context: http://apache-flex-development.247.n4.nabble.com/FlexJS-Debugging-package-tp63288p63306.html Sent from

Re: [FlexJS] Debugging package

2017-07-16 Thread Josh Tynjala
The compiler needs to be modified to support the debugger statement. Ideally, it would also force Flash to pause in the debugger. - Josh On Jul 16, 2017 2:07 AM, "Harbs" wrote: I just added a debugging package to FlexJS. There are two things I don’t know how to do: 1.

Re: [FlexJS] Debugging package

2017-07-16 Thread Harbs
gt; wrote: > > Thank you! :) And I really like the idea :) > > Piotr > > > > - > Apache Flex PMC > piotrzarzyck...@gmail.com > -- > View this message in context: > http://apache-flex-development.247.n4.nabble.com/FlexJS-Debugging-package-tp63288p63

Re: [FlexJS] Debugging package

2017-07-16 Thread Harbs
ntext: > http://apache-flex-development.247.n4.nabble.com/FlexJS-Debugging-package-tp63288p63298.html > Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] Debugging package

2017-07-16 Thread piotrz
: http://apache-flex-development.247.n4.nabble.com/FlexJS-Debugging-package-tp63288p63298.html Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] Debugging package

2017-07-16 Thread piotrz
Thank you! :) And I really like the idea :) Piotr - Apache Flex PMC piotrzarzyck...@gmail.com -- View this message in context: http://apache-flex-development.247.n4.nabble.com/FlexJS-Debugging-package-tp63288p63292.html Sent from the Apache Flex Development mailing list archive

Re: [FlexJS] Debugging package

2017-07-16 Thread Harbs
page. > > Thanks, > Piotr > > > > - > Apache Flex PMC > piotrzarzyck...@gmail.com > -- > View this message in context: > http://apache-flex-development.247.n4.nabble.com/FlexJS-Debugging-package-tp63288p63290.html > Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] Debugging package

2017-07-16 Thread piotrz
/FlexJS-Debugging-package-tp63288p63290.html Sent from the Apache Flex Development mailing list archive at Nabble.com.

[FlexJS] Debugging package

2017-07-16 Thread Harbs
I just added a debugging package to FlexJS. There are two things I don’t know how to do: 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