You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2019/02/20 23:26:34 UTC

[royale-compiler] branch develop updated (8efe085 -> 06ba69d)

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git.


    from 8efe085  SemanticUtils: resolveXML() and resolveXMLType() resolve private/protected members in XML/XMLList so that they aren't coerced
     new 6f91953  compiler-jx: TestBase enables performance caching, similar to the command line compilers
     new 06ba69d  compiler-jx: moved one use Language.closure() to the same place as another because they both should be there

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../internal/codegen/js/goog/JSGoogEmitter.java    | 17 +-----------
 .../codegen/js/jx/MemberAccessEmitter.java         | 32 ++++++++++++++++++++++
 .../royale/compiler/internal/test/TestBase.java    |  4 +++
 3 files changed, 37 insertions(+), 16 deletions(-)


[royale-compiler] 02/02: compiler-jx: moved one use Language.closure() to the same place as another because they both should be there

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 06ba69dbe0c198422db72b5b5eea71c022143c66
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Wed Feb 20 15:26:23 2019 -0800

    compiler-jx: moved one use Language.closure() to the same place as another because they both should be there
---
 .../internal/codegen/js/goog/JSGoogEmitter.java    | 17 +-----------
 .../codegen/js/jx/MemberAccessEmitter.java         | 32 ++++++++++++++++++++++
 2 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index 341c9c7..693c476 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -957,22 +957,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         }
         else
         {
-            // AJH need Language.bind here and maybe not require
-            // that the node is a MemberAccessExpression
-            if (definition instanceof FunctionDefinition &&
-                    !((FunctionDefinition)definition).isStatic() &&
-                    (!(definition instanceof AccessorDefinition)) &&
-                    node instanceof MemberAccessExpressionNode &&
-                    ((MemberAccessExpressionNode)node).getLeftOperandNode().getNodeID() != ASTNodeID.SuperID)
-            {
-                emitClosureStart();
-                getWalker().walk(node);
-                writeToken(ASEmitterTokens.COMMA);
-                getWalker().walk(((MemberAccessExpressionNode)node).getLeftOperandNode());
-                emitClosureEnd(((MemberAccessExpressionNode)node).getLeftOperandNode(), definition);
-            }
-            else
-                getWalker().walk(node);
+            getWalker().walk(node);
         }
     }
 
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/MemberAccessEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
index 009e783..23e5ec0 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
@@ -216,6 +216,27 @@ public class MemberAccessEmitter extends JSSubEmitter implements
 		}
     	else if (rightNode instanceof NamespaceAccessExpressionNode)
     	{
+			boolean isStatic = false;
+			if (def != null && def.isStatic())
+				isStatic = true;
+			boolean needClosure = false;
+			if (def instanceof FunctionDefinition && (!(def instanceof AccessorDefinition))
+					&& !def.getBaseName().equals("constructor")) // don't wrap references to obj.constructor
+			{
+				IASNode parentNode = node.getParent();
+				if (parentNode != null)
+				{
+					ASTNodeID parentNodeId = parentNode.getNodeID();
+					// we need a closure if this MAE is the top-level in a chain
+					// of MAE and not in a function call.
+					needClosure = !isStatic && parentNodeId != ASTNodeID.FunctionCallID &&
+								parentNodeId != ASTNodeID.MemberAccessExpressionID &&
+								parentNodeId != ASTNodeID.ArrayIndexExpressionID;
+				}
+			}
+        	if (needClosure)
+        		getEmitter().emitClosureStart();
+
     		NamespaceAccessExpressionNode naen = (NamespaceAccessExpressionNode)rightNode;
     		IDefinition d = naen.getLeftOperandNode().resolve(getProject());
     		IdentifierNode r = (IdentifierNode)(naen.getRightOperandNode());
@@ -243,6 +264,17 @@ public class MemberAccessEmitter extends JSSubEmitter implements
                 write(node.getOperator().getOperatorText());
 	    		write(r.getName());    			
     		}
+        
+			if (needClosure)
+			{
+				write(ASEmitterTokens.COMMA);
+				write(ASEmitterTokens.SPACE);
+				if (leftNode.getNodeID() == ASTNodeID.SuperID)
+					write(ASEmitterTokens.THIS);
+				else
+					writeLeftSide(node, leftNode, rightNode);
+				getEmitter().emitClosureEnd(leftNode, def);
+			}
     		return;
     	}
         boolean isCustomNamespace = false;


[royale-compiler] 01/02: compiler-jx: TestBase enables performance caching, similar to the command line compilers

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 6f91953015c2040ac0ecd744cef4ddba83f3d436
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Wed Feb 20 14:23:06 2019 -0800

    compiler-jx: TestBase enables performance caching, similar to the command line compilers
---
 .../test/java/org/apache/royale/compiler/internal/test/TestBase.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/test/TestBase.java b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/test/TestBase.java
index cf2ebcd..a89aa85 100644
--- a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/test/TestBase.java
+++ b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/test/TestBase.java
@@ -46,6 +46,7 @@ import org.apache.royale.compiler.codegen.mxml.IMXMLEmitter;
 import org.apache.royale.compiler.config.Configurator;
 import org.apache.royale.compiler.driver.IBackend;
 import org.apache.royale.compiler.internal.codegen.as.ASFilterWriter;
+import org.apache.royale.compiler.internal.definitions.DefinitionBase;
 import org.apache.royale.compiler.internal.projects.RoyaleJSProject;
 import org.apache.royale.compiler.internal.projects.RoyaleProjectConfigurator;
 import org.apache.royale.compiler.internal.projects.ISourceFileHandler;
@@ -108,6 +109,8 @@ public class TestBase implements ITestBase
     @Before
     public void setUp()
     {
+        DefinitionBase.setPerformanceCachingEnabled(true);
+
         errors = new ArrayList<ICompilerProblem>();
 
         if (project == null)
@@ -148,6 +151,7 @@ public class TestBase implements ITestBase
     @After
     public void tearDown()
     {
+        DefinitionBase.setPerformanceCachingEnabled(false);
         backend = null;
         writer = null;
     }