Hmm, In retrospect, I don't know if I am doing this right. This is what I
get for not having JS experience. :)

I know I am creating the packages right but I guess access wise, I don't
need it... The cross compiler should just resolve these things like you do
with qualifiedNames.

I guess I need to stop for a while. :)

Well that part only took me 30 minutes, it was figuring out all the
package/namespace object literal stuff.

Let me know if you see any flaws in my thinking.

Mike

Mike

On Fri, Jun 12, 2015 at 6:47 PM, Michael Schmalle <teotigraphix...@gmail.com
> wrote:

> Well I have just tested the boundaries of what will compile to a swc. Wow,
> I SERIOUSLY did not think I was going to figure this out but a good puzzle
> is always good for the brain.
>
> (sorry for the code but I am trying to explain something)
>
> /**
>  * namespace
>  * @const
>  */
> var chrome = {};
>
> /** @const */
> chrome.app = {};
>
> /**
>  * @type {boolean}
>  */
> chrome.app.isInstalled;
>
> /**
>  * @const
>  */
> chrome.webstore = {};
>
> /**
>  * @const
>  */
> chrome.runtime = {};
>
> /** @type {!Object|undefined} */
> chrome.runtime.lastError = {};
>
> /** @type {string|undefined} */
> chrome.runtime.lastError.message;
>
>
> Long story short,  chrome, chrome.app,  chrome.webstore, chrome.runtime
> are Literal Classes(Object Literals). I spent 3 hours thinking about how
> the hell this was going to be possible with code completion. I studied the
> problem and realized I need to make classes for all namespace object
> literals.
>
> Then, chrome is a root level namespace so it's app, webstore and runtime
> instances need to be static. Then I couldn't access the next in line
> lastError from chrome.runtime. So a non root level var needs to be non
> static, then every other property/var up the chain needs to be non static.
>
> So the outcome is, I have 4 passes in the compiler now and I got it to
> work! Crazy enough the COMPC compiler actually compiles this mess. The
> classes are the same name as the package name it's next to. :)
>
> The only problem is IJ wants to optimize it to an import which is
> incorrect but, hey it's works.
>
> "I think" this means I am close to getting packages to work. I will have
> to try a lot more tests before I feel like I have this working for
> different situations.
>
> Image of the emitted class and code;
>
> http://snag.gy/XzveF.jpg
>
> Mike
>
>
>
>
> On Fri, Jun 12, 2015 at 12:15 PM, Alex Harui <aha...@adobe.com> wrote:
>
>>
>>
>> On 6/12/15, 9:00 AM, "Michael Schmalle" <teotigraphix...@gmail.com>
>> wrote:
>>
>> >You know, I am being an idiot, I can work on compilers but it the simple
>> >things that confuse me. What is the correct way to test nightlies of
>> >FlexJS? I tried building the installer.xml in flex-asjs and it totally
>> >screwed up the folder.
>> >
>> >So what should I have setup to test the compiler with FlexJS projects?
>>
>> Run the Installer, or grab the binary package, unzip it and run
>> installer.xml in that.
>>
>> When just doing dev work without FB integration, I just point some
>> environment variables at the Falcon repo and use Ant to compile the
>> examples.
>>
>> I’m off-line for the rest of the AM.  Hopefully others can help you get
>> unstuck.
>>
>> -Alex
>>
>>
>

Reply via email to