Re: [royale-compiler] 01/01: Works on given test case. Hope I didn't break anything.

2020-04-05 Thread Greg Dove
output for the Language.closure method needs 3 args iirc

1. the method reference
2. the 'this' reference that is being bound to
3. the stringified method reference name from (1)

I think the goal should be something like this:

org.apache.royale.utils.Language.closure(this.parentApplication.buttonFunction,
this.parentApplication, ' buttonFunction');

I can't spend more time on that right now, but if you want to try that
might help


On Mon, Apr 6, 2020 at 9:16 AM Yishay Weiss  wrote:

> Hi,
>
> Changing to
> emitClosureStart();
>
> emitAssignedValue(assignedNode);
> MemberAccessExpressionNode
> maenode = (MemberAccessExpressionNode)assignedNode;
>
> emitClosureEnd(maenode.getLeftOperandNode(), definition);
>
> Results in
>
>   org.apache.royale.utils.Language.as(c, MyButton).clickFunction =
> org.apache.royale.utils.Language.closure(this.parentApplication.buttonFunction,
> 'Function');
>
> Which fails with
>
> TypeError: Object.defineProperty called on non-object
> Watch
> Call Stack
> org.apache.royale.utils.Language.closure
> Language.js:281
> MyBox.addElement
> MyBox.js:39
>
> From: Greg Dove
> Sent: Monday, April 6, 2020 12:07 AM
> To: Apache Royale Development
> Subject: Re: [royale-compiler] 01/01: Works on given test case. Hope I
> didn't break anything.
>
> Take a look at emitClosureStart and emitClosureEnd I think those will help
> out.
>
>
> On Mon, Apr 6, 2020 at 9:01 AM Greg Dove  wrote:
>
> >
> > You might find a place in the code where there is something already that
> > has 'needClosure' logic, but the logic that sets it to true does not yet
> > include the specific case you are dealing with.
> >
> > On Mon, Apr 6, 2020 at 8:53 AM Greg Dove  wrote:
> >
> >> I think it's a great start Yishay. But I'd suggest you look for other
> >> areas of the compiler code where there is a generation of
> Language.closure
> >> output. This should do the same thing I think, but be consistent.
> >>
> >>
> >> On Mon, Apr 6, 2020 at 8:51 AM  wrote:
> >>
> >>> This is an automated email from the ASF dual-hosted git repository.
> >>>
> >>> yishayw pushed a commit to branch issue_143
> >>> in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
> >>>
> >>> commit 634cb4f3362c75317538ba0daedafd19742d00df
> >>> Author: DESKTOP-RH4S838\Yishay 
> >>> AuthorDate: Sun Apr 5 23:48:11 2020 +0300
> >>>
> >>> Works on given test case. Hope I didn't break anything.
> >>>
> >>> Reference #143
> >>> ---
> >>>  .../royale/compiler/internal/codegen/js/JSEmitter.java| 15
> >>> ++-
> >>>  1 file changed, 14 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git
> >>>
> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
> >>>
> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
> >>> index d24adca..24c65f3 100644
> >>> ---
> >>>
> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
> >>> +++
> >>>
> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
> >>> @@ -40,6 +40,7 @@ import
> >>> org.apache.royale.compiler.definitions.metadata.IMetaTag;
> >>>  import
> >>> org.apache.royale.compiler.definitions.metadata.IMetaTagAttribute;
> >>>  import org.apache.royale.compiler.internal.codegen.as.ASEmitter;
> >>>  import org.apache.royale.compiler.internal.codegen.as
> .ASEmitterTokens;
> >>> +import
> >>>
> org.apache.royale.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
> >>>  import
> >>> org.apache.royale.compiler.internal.codegen.js.jx.BlockCloseEmitter;
> >>>  import
> >>> org.apache.royale.compiler.internal.codegen.js.jx.BlockOpenEmitter;
> >>>  import org.apache.royale.compiler.internal.codegen.js.jx.CatchEmitter;
> >>> @@ -914,7 +915,19 @@ public class JSEmitter extends ASEmitter
> implements
> >>> IJSEmitter
> >>> {
> >>> write(coercionStart);
> >>>  }
> >>> -emitAssignedValue(assignedNode);
> >>> +   if
> >>> (project.getBuiltinType(BuiltinType.FUNCTION).equals(definition) &&
> >>> +   assignedNode instanceof
> >>> MemberAccessExpressionNode) {
> >>> +   write(JSGoogEmitterTokens.GOOG_BIND.getToken()
> +
> >>> +
> >>>  ASEmitterTokens.PAREN_OPEN.getToken()
> >>> +   );
> >>> +   emitAssignedValue(assignedNode);
> >>> +   write(ASEmitterTokens.COMMA.getToken());
> >>> +   MemberAccessExpressionNode maenode =
> >>> (MemberAccessExpressionNode)assignedNode;
> >>> +   getWalker().walk(maenode.getLeftOperandNode());
> >>> +   write(ASEmitterTokens.PAREN_CLOSE.getToken());
> >>> +   } else {
> >>> +   

RE: [royale-compiler] 01/01: Works on given test case. Hope I didn't break anything.

2020-04-05 Thread Yishay Weiss
Hi,

Changing to
emitClosureStart();
emitAssignedValue(assignedNode);
MemberAccessExpressionNode 
maenode = (MemberAccessExpressionNode)assignedNode;

emitClosureEnd(maenode.getLeftOperandNode(), definition);

Results in

  org.apache.royale.utils.Language.as(c, MyButton).clickFunction = 
org.apache.royale.utils.Language.closure(this.parentApplication.buttonFunction, 
'Function');

Which fails with

TypeError: Object.defineProperty called on non-object
Watch
Call Stack
org.apache.royale.utils.Language.closure
Language.js:281
MyBox.addElement
MyBox.js:39

From: Greg Dove
Sent: Monday, April 6, 2020 12:07 AM
To: Apache Royale Development
Subject: Re: [royale-compiler] 01/01: Works on given test case. Hope I didn't 
break anything.

Take a look at emitClosureStart and emitClosureEnd I think those will help
out.


On Mon, Apr 6, 2020 at 9:01 AM Greg Dove  wrote:

>
> You might find a place in the code where there is something already that
> has 'needClosure' logic, but the logic that sets it to true does not yet
> include the specific case you are dealing with.
>
> On Mon, Apr 6, 2020 at 8:53 AM Greg Dove  wrote:
>
>> I think it's a great start Yishay. But I'd suggest you look for other
>> areas of the compiler code where there is a generation of Language.closure
>> output. This should do the same thing I think, but be consistent.
>>
>>
>> On Mon, Apr 6, 2020 at 8:51 AM  wrote:
>>
>>> This is an automated email from the ASF dual-hosted git repository.
>>>
>>> yishayw pushed a commit to branch issue_143
>>> in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
>>>
>>> commit 634cb4f3362c75317538ba0daedafd19742d00df
>>> Author: DESKTOP-RH4S838\Yishay 
>>> AuthorDate: Sun Apr 5 23:48:11 2020 +0300
>>>
>>> Works on given test case. Hope I didn't break anything.
>>>
>>> Reference #143
>>> ---
>>>  .../royale/compiler/internal/codegen/js/JSEmitter.java| 15
>>> ++-
>>>  1 file changed, 14 insertions(+), 1 deletion(-)
>>>
>>> diff --git
>>> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>>> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>>> index d24adca..24c65f3 100644
>>> ---
>>> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>>> +++
>>> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>>> @@ -40,6 +40,7 @@ import
>>> org.apache.royale.compiler.definitions.metadata.IMetaTag;
>>>  import
>>> org.apache.royale.compiler.definitions.metadata.IMetaTagAttribute;
>>>  import org.apache.royale.compiler.internal.codegen.as.ASEmitter;
>>>  import org.apache.royale.compiler.internal.codegen.as.ASEmitterTokens;
>>> +import
>>> org.apache.royale.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
>>>  import
>>> org.apache.royale.compiler.internal.codegen.js.jx.BlockCloseEmitter;
>>>  import
>>> org.apache.royale.compiler.internal.codegen.js.jx.BlockOpenEmitter;
>>>  import org.apache.royale.compiler.internal.codegen.js.jx.CatchEmitter;
>>> @@ -914,7 +915,19 @@ public class JSEmitter extends ASEmitter implements
>>> IJSEmitter
>>> {
>>> write(coercionStart);
>>>  }
>>> -emitAssignedValue(assignedNode);
>>> +   if
>>> (project.getBuiltinType(BuiltinType.FUNCTION).equals(definition) &&
>>> +   assignedNode instanceof
>>> MemberAccessExpressionNode) {
>>> +   write(JSGoogEmitterTokens.GOOG_BIND.getToken() +
>>> +
>>>  ASEmitterTokens.PAREN_OPEN.getToken()
>>> +   );
>>> +   emitAssignedValue(assignedNode);
>>> +   write(ASEmitterTokens.COMMA.getToken());
>>> +   MemberAccessExpressionNode maenode =
>>> (MemberAccessExpressionNode)assignedNode;
>>> +   getWalker().walk(maenode.getLeftOperandNode());
>>> +   write(ASEmitterTokens.PAREN_CLOSE.getToken());
>>> +   } else {
>>> +   emitAssignedValue(assignedNode);
>>> +   }
>>> if (coercionStart != null)
>>> {
>>> if (coercionEnd != null)
>>>
>>>



Re: [royale-compiler] 01/01: Works on given test case. Hope I didn't break anything.

2020-04-05 Thread Greg Dove
Take a look at emitClosureStart and emitClosureEnd I think those will help
out.


On Mon, Apr 6, 2020 at 9:01 AM Greg Dove  wrote:

>
> You might find a place in the code where there is something already that
> has 'needClosure' logic, but the logic that sets it to true does not yet
> include the specific case you are dealing with.
>
> On Mon, Apr 6, 2020 at 8:53 AM Greg Dove  wrote:
>
>> I think it's a great start Yishay. But I'd suggest you look for other
>> areas of the compiler code where there is a generation of Language.closure
>> output. This should do the same thing I think, but be consistent.
>>
>>
>> On Mon, Apr 6, 2020 at 8:51 AM  wrote:
>>
>>> This is an automated email from the ASF dual-hosted git repository.
>>>
>>> yishayw pushed a commit to branch issue_143
>>> in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
>>>
>>> commit 634cb4f3362c75317538ba0daedafd19742d00df
>>> Author: DESKTOP-RH4S838\Yishay 
>>> AuthorDate: Sun Apr 5 23:48:11 2020 +0300
>>>
>>> Works on given test case. Hope I didn't break anything.
>>>
>>> Reference #143
>>> ---
>>>  .../royale/compiler/internal/codegen/js/JSEmitter.java| 15
>>> ++-
>>>  1 file changed, 14 insertions(+), 1 deletion(-)
>>>
>>> diff --git
>>> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>>> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>>> index d24adca..24c65f3 100644
>>> ---
>>> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>>> +++
>>> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>>> @@ -40,6 +40,7 @@ import
>>> org.apache.royale.compiler.definitions.metadata.IMetaTag;
>>>  import
>>> org.apache.royale.compiler.definitions.metadata.IMetaTagAttribute;
>>>  import org.apache.royale.compiler.internal.codegen.as.ASEmitter;
>>>  import org.apache.royale.compiler.internal.codegen.as.ASEmitterTokens;
>>> +import
>>> org.apache.royale.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
>>>  import
>>> org.apache.royale.compiler.internal.codegen.js.jx.BlockCloseEmitter;
>>>  import
>>> org.apache.royale.compiler.internal.codegen.js.jx.BlockOpenEmitter;
>>>  import org.apache.royale.compiler.internal.codegen.js.jx.CatchEmitter;
>>> @@ -914,7 +915,19 @@ public class JSEmitter extends ASEmitter implements
>>> IJSEmitter
>>> {
>>> write(coercionStart);
>>>  }
>>> -emitAssignedValue(assignedNode);
>>> +   if
>>> (project.getBuiltinType(BuiltinType.FUNCTION).equals(definition) &&
>>> +   assignedNode instanceof
>>> MemberAccessExpressionNode) {
>>> +   write(JSGoogEmitterTokens.GOOG_BIND.getToken() +
>>> +
>>>  ASEmitterTokens.PAREN_OPEN.getToken()
>>> +   );
>>> +   emitAssignedValue(assignedNode);
>>> +   write(ASEmitterTokens.COMMA.getToken());
>>> +   MemberAccessExpressionNode maenode =
>>> (MemberAccessExpressionNode)assignedNode;
>>> +   getWalker().walk(maenode.getLeftOperandNode());
>>> +   write(ASEmitterTokens.PAREN_CLOSE.getToken());
>>> +   } else {
>>> +   emitAssignedValue(assignedNode);
>>> +   }
>>> if (coercionStart != null)
>>> {
>>> if (coercionEnd != null)
>>>
>>>


Re: [royale-compiler] 01/01: Works on given test case. Hope I didn't break anything.

2020-04-05 Thread Greg Dove
You might find a place in the code where there is something already that
has 'needClosure' logic, but the logic that sets it to true does not yet
include the specific case you are dealing with.

On Mon, Apr 6, 2020 at 8:53 AM Greg Dove  wrote:

> I think it's a great start Yishay. But I'd suggest you look for other
> areas of the compiler code where there is a generation of Language.closure
> output. This should do the same thing I think, but be consistent.
>
>
> On Mon, Apr 6, 2020 at 8:51 AM  wrote:
>
>> This is an automated email from the ASF dual-hosted git repository.
>>
>> yishayw pushed a commit to branch issue_143
>> in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
>>
>> commit 634cb4f3362c75317538ba0daedafd19742d00df
>> Author: DESKTOP-RH4S838\Yishay 
>> AuthorDate: Sun Apr 5 23:48:11 2020 +0300
>>
>> Works on given test case. Hope I didn't break anything.
>>
>> Reference #143
>> ---
>>  .../royale/compiler/internal/codegen/js/JSEmitter.java| 15
>> ++-
>>  1 file changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git
>> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>> index d24adca..24c65f3 100644
>> ---
>> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>> +++
>> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
>> @@ -40,6 +40,7 @@ import
>> org.apache.royale.compiler.definitions.metadata.IMetaTag;
>>  import org.apache.royale.compiler.definitions.metadata.IMetaTagAttribute;
>>  import org.apache.royale.compiler.internal.codegen.as.ASEmitter;
>>  import org.apache.royale.compiler.internal.codegen.as.ASEmitterTokens;
>> +import
>> org.apache.royale.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
>>  import
>> org.apache.royale.compiler.internal.codegen.js.jx.BlockCloseEmitter;
>>  import
>> org.apache.royale.compiler.internal.codegen.js.jx.BlockOpenEmitter;
>>  import org.apache.royale.compiler.internal.codegen.js.jx.CatchEmitter;
>> @@ -914,7 +915,19 @@ public class JSEmitter extends ASEmitter implements
>> IJSEmitter
>> {
>> write(coercionStart);
>>  }
>> -emitAssignedValue(assignedNode);
>> +   if
>> (project.getBuiltinType(BuiltinType.FUNCTION).equals(definition) &&
>> +   assignedNode instanceof
>> MemberAccessExpressionNode) {
>> +   write(JSGoogEmitterTokens.GOOG_BIND.getToken() +
>> +
>>  ASEmitterTokens.PAREN_OPEN.getToken()
>> +   );
>> +   emitAssignedValue(assignedNode);
>> +   write(ASEmitterTokens.COMMA.getToken());
>> +   MemberAccessExpressionNode maenode =
>> (MemberAccessExpressionNode)assignedNode;
>> +   getWalker().walk(maenode.getLeftOperandNode());
>> +   write(ASEmitterTokens.PAREN_CLOSE.getToken());
>> +   } else {
>> +   emitAssignedValue(assignedNode);
>> +   }
>> if (coercionStart != null)
>> {
>> if (coercionEnd != null)
>>
>>


Re: [royale-compiler] 01/01: Works on given test case. Hope I didn't break anything.

2020-04-05 Thread Greg Dove
I think it's a great start Yishay. But I'd suggest you look for other areas
of the compiler code where there is a generation of Language.closure
output. This should do the same thing I think, but be consistent.


On Mon, Apr 6, 2020 at 8:51 AM  wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> yishayw pushed a commit to branch issue_143
> in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
>
> commit 634cb4f3362c75317538ba0daedafd19742d00df
> Author: DESKTOP-RH4S838\Yishay 
> AuthorDate: Sun Apr 5 23:48:11 2020 +0300
>
> Works on given test case. Hope I didn't break anything.
>
> Reference #143
> ---
>  .../royale/compiler/internal/codegen/js/JSEmitter.java| 15
> ++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git
> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
> index d24adca..24c65f3 100644
> ---
> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
> +++
> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSEmitter.java
> @@ -40,6 +40,7 @@ import
> org.apache.royale.compiler.definitions.metadata.IMetaTag;
>  import org.apache.royale.compiler.definitions.metadata.IMetaTagAttribute;
>  import org.apache.royale.compiler.internal.codegen.as.ASEmitter;
>  import org.apache.royale.compiler.internal.codegen.as.ASEmitterTokens;
> +import
> org.apache.royale.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
>  import
> org.apache.royale.compiler.internal.codegen.js.jx.BlockCloseEmitter;
>  import org.apache.royale.compiler.internal.codegen.js.jx.BlockOpenEmitter;
>  import org.apache.royale.compiler.internal.codegen.js.jx.CatchEmitter;
> @@ -914,7 +915,19 @@ public class JSEmitter extends ASEmitter implements
> IJSEmitter
> {
> write(coercionStart);
>  }
> -emitAssignedValue(assignedNode);
> +   if
> (project.getBuiltinType(BuiltinType.FUNCTION).equals(definition) &&
> +   assignedNode instanceof
> MemberAccessExpressionNode) {
> +   write(JSGoogEmitterTokens.GOOG_BIND.getToken() +
> +
>  ASEmitterTokens.PAREN_OPEN.getToken()
> +   );
> +   emitAssignedValue(assignedNode);
> +   write(ASEmitterTokens.COMMA.getToken());
> +   MemberAccessExpressionNode maenode =
> (MemberAccessExpressionNode)assignedNode;
> +   getWalker().walk(maenode.getLeftOperandNode());
> +   write(ASEmitterTokens.PAREN_CLOSE.getToken());
> +   } else {
> +   emitAssignedValue(assignedNode);
> +   }
> if (coercionStart != null)
> {
> if (coercionEnd != null)
>
>


Re: RoyalUnit tests now running in release mode

2020-04-05 Thread Harbs
Awesome!

> On Apr 5, 2020, at 9:00 AM, Alex Harui  wrote:
> 
> Sounds great!  Thanks for doing it.
> 
> -Alex
> 
> On 4/4/20, 10:55 PM, "Greg Dove"  wrote:
> 
>Just a heads-up. I had mentioned to Josh that I wanted to make this change.
>There were a couple of compiler changes in recent months that broke release
>build behaviour, and having the unit tests working in release mode would
>have red-flagged those immediately.
> 
>So that is how they are now run. If any tests fail in release mode then the
>same tests are run in debug mode, at which point the build fails.
>If there is a difference between passing and failing (as a full set of
>tests) between js-release and js-debug tests then you should see that
>logged in the console as the last thing before the build fails.
> 
>Also if there is a fail, there will be junit reports for both release and
>debug tests included, so you can compare the tests that failed in
>js-release vs. js-debug.
> 
>If you are building locally and the test that failed is still in your
>browser, you should simply be able to append '?local' to the end of the url
>in the browser, hit refresh, and it will run a non-CI version, in this case
>you should get some useful information in the browser console (it may not
>be that helpful in release mode because of the renaming, but it will
>hopefully provide a starting point).
> 
>Hope that all makes sense and if anyone else wants to join the unit
>test party, feel free to start adding more tests. :)
> 
> 



Royale Compiler Build Tools Release Step 001 Succeeded

2020-04-05 Thread apacheroyaleci
Log in to the server, open a command prompt, change directory to 
C:\jenkins\workspace\Royale_Compiler_Build_Tools_Release_Step_001 and run the 
following commands:
git push --set-upstream origin develop
git push origin org.apache.royale.compiler-build-tools-1.2.0-rc2

You will need your Apache/Github username and 2FA token.

Re: RoyalUnit tests now running in release mode

2020-04-05 Thread Alex Harui
Sounds great!  Thanks for doing it.

-Alex

On 4/4/20, 10:55 PM, "Greg Dove"  wrote:

Just a heads-up. I had mentioned to Josh that I wanted to make this change.
There were a couple of compiler changes in recent months that broke release
build behaviour, and having the unit tests working in release mode would
have red-flagged those immediately.

So that is how they are now run. If any tests fail in release mode then the
same tests are run in debug mode, at which point the build fails.
If there is a difference between passing and failing (as a full set of
tests) between js-release and js-debug tests then you should see that
logged in the console as the last thing before the build fails.

Also if there is a fail, there will be junit reports for both release and
debug tests included, so you can compare the tests that failed in
js-release vs. js-debug.

If you are building locally and the test that failed is still in your
browser, you should simply be able to append '?local' to the end of the url
in the browser, hit refresh, and it will run a non-CI version, in this case
you should get some useful information in the browser console (it may not
be that helpful in release mode because of the renaming, but it will
hopefully provide a starting point).

Hope that all makes sense and if anyone else wants to join the unit
test party, feel free to start adding more tests. :)