Hi,

Well for me, this is like walking on the moon. I knew that this little
tangent I was going down was not going to be real until the following
things happened;

1. I wrote a parser/translator for javascript external API.
2. I wrote a resolver that could understand all the javascript to create a
hierarchy which would then produce valid AS to compile.
3. Compile this translated JS -> AS into a swc that Falcon would compile
AND Falcon could load for projects using JS.swc.
4. Write a simple Hello FalconJX app that used the built JS.swc and a
Main.as file that was used with the MXMLJS compiler, using library and
source paths.
5. Cross compile that compilation result into JS using the FlexJS emitter.

Well, for myself this round trip is one of my better accomplishments in
regards to patients. So without further ado, I present the first NO
PLAYERGLOBAL production of a strictly Javascript created API in
ActionScript!

IntellIJ Application setup with JS.swc created by Falcon (no
playerglobal.swc)

http://snag.gy/7mOG1.jpg

So what actually happened, is I started with Rhino and QDoc, then I went
down the rabbit hols and started studying the Closure compiler source code,
WOW it used the same AST as Rhino but it supports ES6.

So over the weekend I took the time to get everything just sing the closure
compiler parser and compiler! I am using the JAVA API not the command line,
I wrote 2 custom compiler passes, the first gets all the Types, the second
get all the members using AST.

This was important because I need all the types existing before members are
added to my reference model.

Anyway, Rhino and QDox deps are axed and I am just using the GCC code base
right now.

The bright spot is all the external js files we digest cet compiled with
GCC and we get warnings or errors, this could be good for external libs to
make sure everything is working.

I have more I need to write but I am fried. :) This last screen shot is my
roundtrip test if you are wondering what I did to test the full "tool
chain".

http://snag.gy/JMppY.jpg


Mike



------------------------------------------------------
ActionScript
------------------------------------------------------

package {

public class Main {

    public function Main() {
        var button:Element = document.createElement("button", null);
        button.textContent = "Say Hello";
        button.onclick = function ():void {
            button.textContent = "Say Hello FalconJX!";
        };
        document.body.appendChild(button);
    }
}
}

------------------------------------------------------
JavaScript production
------------------------------------------------------

/**
 * Main
 *
 * @fileoverview
 *
 * @suppress {checkTypes}
 */

goog.provide('Main');



/**
 * @constructor
 */
Main = function() {
  var self = this;
  var /** @type {Element} */ button = document.createElement("button",
null);
  button.textContent = "Say Hello";
  button.onclick = function() {
    button.textContent = "Say Hello FalconJX!";
  };
  document.body.appendChild(button);
};


/**
 * Metadata
 *
 * @type {Object.<string, Array.<Object>>}
 */
Main.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Main', qName:
'Main'}] };

Reply via email to