You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2021/01/07 01:31:51 UTC

[royale-compiler] branch develop updated: Reverting parts of the earlier change in here, and simplifying the initial check. Left some notes to revisit this for potential future iteration of function call argumentsNode

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new eac9126  Reverting parts of the earlier change in here, and simplifying the initial check. Left some notes to revisit this for potential future iteration of function call argumentsNode
eac9126 is described below

commit eac912667555ca57c372dca1f3bd1b34f8d8c4d4
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Jan 7 14:31:21 2021 +1300

    Reverting parts of the earlier change in here, and simplifying the initial check. Left some notes to revisit this for potential future iteration of function call argumentsNode
---
 .../internal/codegen/js/jx/FieldEmitter.java       | 32 ++++------------------
 1 file changed, 6 insertions(+), 26 deletions(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/FieldEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/FieldEmitter.java
index 91195a8..d21aca8 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/FieldEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/FieldEmitter.java
@@ -78,12 +78,6 @@ public class FieldEmitter extends JSSubEmitter implements
     		if (def == null)  // saw this for a package reference (org in org.apache)
     			return false;
     		String qname = def.getQualifiedName();
-    		if (def instanceof IFunctionDefinition) {
-                if (vnode.getAncestorOfType(FunctionCallNode.class) != null){
-                    def = ((IFunctionDefinition) def).resolveReturnType(getProject());
-                    qname = def.getQualifiedName();
-                }
-            }
     		if (NativeUtils.isJSNative(qname))
     			return false;
     		if (def instanceof IClassDefinition)
@@ -92,6 +86,8 @@ public class FieldEmitter extends JSSubEmitter implements
     		if (def != null)
     		{
     			qname = def.getQualifiedName();
+                if (NativeUtils.isJSNative(qname))
+                    return false;
     			return !(qname.contentEquals(cdef.getQualifiedName()));
     		}
     	}
@@ -103,29 +99,13 @@ public class FieldEmitter extends JSSubEmitter implements
     		{
     			if (isExternalReference((IExpressionNode)childNode, cdef))
     				return true;
-    		} else if (childNode instanceof IContainerNode) {
-    		    if (checkContainer((IContainerNode)childNode,cdef ))
-    		        return true;
-            }
+    		}
+    		//if  childNode is a ContainerNode (e.g. argumentsNode of FunctionCallNode),
+            //should we be checking the arguments as well? Doing so (*and* returning true because one of the argument nodes is an external reference)
+            //seems to cause issues, so avoiding this for now.
     	}
     	return false;
     }
-
-    private boolean checkContainer(IContainerNode containerNode, IClassDefinition cdef){
-        int n = containerNode.getChildCount();
-        for (int i = 0; i < n; i++)
-        {
-            IASNode childNode = containerNode.getChild(i);
-            if (childNode instanceof IExpressionNode) {
-                if (isExternalReference((IExpressionNode)childNode, cdef))
-                    return true;
-            } else if (childNode instanceof IContainerNode) {
-                if (checkContainer((IContainerNode) childNode,cdef ))
-                    return true;
-            }
-        }
-        return false;
-    }
     
     @Override
     public void emit(IVariableNode node)