You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/10/10 19:33:46 UTC

[royale-compiler] branch develop updated (938beb2 -> d8f8b83)

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

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


    from 938beb2  [maven-release-plugin] prepare for next development iteration
     new 0d4bf46  generate proper structures for mx:RemoteObject with mx:method with mx:arguments
     new d24a4e6  be smarter about what to generate.  Look for a single actual tag among the whitespace
     new dee493d  more tweaking of codegen for remoteobject
     new 39d58aa  add support for RemoteObject
     new f7a90ae  fix proxy output
     new ddf6771  fix namespace output
     new 79f8458  oops, wrong name
     new d8f8b83  also suppress binding warnings if proxy

The 8 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:
 .../royale/compiler/codegen/mxml/IMXMLEmitter.java |   8 ++
 .../codegen/js/jx/BinaryOperatorEmitter.java       |   2 +-
 .../codegen/js/jx/MemberAccessEmitter.java         |   4 +-
 .../internal/codegen/mxml/MXMLBlockWalker.java     |  20 ++++
 .../internal/codegen/mxml/MXMLEmitter.java         |  14 +++
 .../codegen/mxml/royale/MXMLRoyaleEmitter.java     | 122 ++++++++++++++++++++-
 .../internal/visitor/mxml/MXMLNodeSwitch.java      |  10 +-
 .../compiler/visitor/mxml/IMXMLBlockVisitor.java   |   8 ++
 .../as/codegen/MXMLClassDirectiveProcessor.java    |  63 +++++++++++
 .../codegen/databinding/WatcherAnalyzer.java       |  14 ++-
 .../tree/mxml/MXMLClassReferenceNodeBase.java      |  14 +--
 .../internal/tree/mxml/MXMLObjectNode.java         |  29 +++++
 .../tree/mxml/MXMLPropertySpecifierNode.java       |  53 +++++++--
 13 files changed, 338 insertions(+), 23 deletions(-)


[royale-compiler] 01/08: generate proper structures for mx:RemoteObject with mx:method with mx:arguments

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

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

commit 0d4bf46e6b8a5b2c5d2f4ca3edcbf5dd86c71ce9
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Oct 8 10:14:22 2018 -0700

    generate proper structures for mx:RemoteObject with mx:method with mx:arguments
---
 .../tree/mxml/MXMLClassReferenceNodeBase.java      | 14 +++++-----
 .../internal/tree/mxml/MXMLObjectNode.java         | 29 ++++++++++++++++++++
 .../tree/mxml/MXMLPropertySpecifierNode.java       | 31 +++++++++++++++++-----
 3 files changed, 61 insertions(+), 13 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLClassReferenceNodeBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLClassReferenceNodeBase.java
index 569d36e..1327d7a 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLClassReferenceNodeBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLClassReferenceNodeBase.java
@@ -439,7 +439,7 @@ abstract class MXMLClassReferenceNodeBase extends MXMLNodeBase implements IMXMLC
         if (childNode != null)
         {
             // This tag is not part of the default property value.
-            processNonDefaultPropertyContentUnit(builder, info);
+            processNonDefaultPropertyContentUnit(builder, info, tag);
 
             childNode.setSuffix(builder, childTag.getStateName());
             childNode.initializeFromTag(builder, childTag);
@@ -503,7 +503,7 @@ abstract class MXMLClassReferenceNodeBase extends MXMLNodeBase implements IMXMLC
                 else
                 {
                     // This tag is not part of the default property value.
-                    processNonDefaultPropertyContentUnit(builder, info);
+                    processNonDefaultPropertyContentUnit(builder, info, tag);
 
                     MXMLInstanceNode instanceNode = MXMLInstanceNode.createInstanceNode(
                             builder, definition.getQualifiedName(), this);
@@ -527,7 +527,7 @@ abstract class MXMLClassReferenceNodeBase extends MXMLNodeBase implements IMXMLC
 	                        processDefaultPropertyContentUnit(builder, childTag, info);
 	                        // seems strange we have to finish default property processing
 	                        // by calling nonDefaultProperty code
-	                        processNonDefaultPropertyContentUnit(builder, info);
+	                        processNonDefaultPropertyContentUnit(builder, info, tag);
 	                        return;
                         }
                 	}
@@ -596,7 +596,7 @@ abstract class MXMLClassReferenceNodeBase extends MXMLNodeBase implements IMXMLC
                 // or instance tags.
 
                 // This tag is not part of the default property value.
-                processNonDefaultPropertyContentUnit(builder, info);
+                processNonDefaultPropertyContentUnit(builder, info, tag);
 
                 super.processChildTag(builder, tag, childTag, info);
             }
@@ -663,7 +663,7 @@ abstract class MXMLClassReferenceNodeBase extends MXMLNodeBase implements IMXMLC
     /**
      * Called on each content unit that is not part of the default value.
      */
-    private void processNonDefaultPropertyContentUnit(MXMLTreeBuilder builder, MXMLNodeInfo info)
+    private void processNonDefaultPropertyContentUnit(MXMLTreeBuilder builder, MXMLNodeInfo info, IMXMLTagData parentTag)
     {
         // If this gets called and we're processing the default property,
         // then childTag is the first child tag after the default property value tags.
@@ -702,7 +702,7 @@ abstract class MXMLClassReferenceNodeBase extends MXMLNodeBase implements IMXMLC
             IVariableDefinition defaultPropertyDefinition =
                     getDefaultPropertyDefinition(builder);
             defaultPropertyNode.initializeDefaultProperty(
-                    builder, defaultPropertyDefinition, defaultPropertyContentUnitsWithoutTrailingScriptTags);
+                    builder, defaultPropertyDefinition, parentTag, defaultPropertyContentUnitsWithoutTrailingScriptTags);
 
             // Now create MXMLScriptNode's for all the trailing script tags.
             for (IMXMLUnitData scriptTagData : trailingScriptTags)
@@ -812,7 +812,7 @@ abstract class MXMLClassReferenceNodeBase extends MXMLNodeBase implements IMXMLC
         // If the last child unit was part of the default property,
         // we don't know to process the default property units
         // until we get here.
-        processNonDefaultPropertyContentUnit(builder, info);
+        processNonDefaultPropertyContentUnit(builder, info, tag);
 
         setChildren(info.getChildNodeList().toArray(new IMXMLNode[0]));
 
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLObjectNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLObjectNode.java
index fd19ec3..04f98a1 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLObjectNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLObjectNode.java
@@ -19,9 +19,16 @@
 
 package org.apache.royale.compiler.internal.tree.mxml;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.royale.compiler.constants.IASLanguageConstants;
+import org.apache.royale.compiler.internal.projects.RoyaleProject;
 import org.apache.royale.compiler.internal.tree.as.NodeBase;
+import org.apache.royale.compiler.mxml.IMXMLTagData;
+import org.apache.royale.compiler.mxml.IMXMLUnitData;
 import org.apache.royale.compiler.tree.ASTNodeID;
+import org.apache.royale.compiler.tree.mxml.IMXMLNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLObjectNode;
 
 /**
@@ -48,4 +55,26 @@ class MXMLObjectNode extends MXMLInstanceNode implements IMXMLObjectNode
     {
         return IASLanguageConstants.Object;
     }
+    
+    public void initialize(MXMLTreeBuilder builder, IMXMLTagData parentTag, List<IMXMLUnitData> contentUnits, MXMLNodeInfo info)
+	{
+    	RoyaleProject project = builder.getProject();
+
+    	// Set the location of the implicit array node
+    	// to span the tags that specify the default property value.
+    	setLocation(builder, contentUnits);
+
+    	setClassReference(project, IASLanguageConstants.Object);
+
+    	for (IMXMLUnitData unit : contentUnits)
+    	{
+    		if (unit instanceof IMXMLTagData)
+    		{
+    			IMXMLTagData tag = (IMXMLTagData)unit;
+    			processChildTag(builder, parentTag, tag, info);
+    		}
+    	}
+    	initializationComplete(builder, parentTag, info);
+	}
+
 }
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
index ba39ef3..acc8641 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
@@ -289,19 +289,32 @@ class MXMLPropertySpecifierNode extends MXMLSpecifierNodeBase implements IMXMLPr
                             !definition.getQualifiedName().contains(IASLanguageConstants.Vector + ".<"))
                     {
                         initializeDefaultProperty(builder, (IVariableDefinition)getDefinition(), 
-                                getListOfUnits(tag));
+                                tag, getListOfUnits(tag));
                         return;
                     }
                     else if (propertyTypeName.equals(IASLanguageConstants.Array) && (definition != null) &&
                             !definition.getQualifiedName().equals(IASLanguageConstants.Array))
                     {
                         initializeDefaultProperty(builder, (IVariableDefinition)getDefinition(), 
-                                getListOfUnits(tag));
+                                tag, getListOfUnits(tag));
                         return;                        
                     }
                 }
             }
         }
+        else if (propertyTypeName.contains(IASLanguageConstants.Object))
+        {
+            // Process each content unit.
+            for (IMXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
+            {
+                if (unit instanceof IMXMLTagData)
+                {
+                    initializeDefaultProperty(builder, (IVariableDefinition)getDefinition(), 
+                                tag, getListOfUnits(tag));
+                    return;                        
+                }
+            }
+        }
         super.initializeFromTag(builder, tag);
     }
     
@@ -334,7 +347,7 @@ class MXMLPropertySpecifierNode extends MXMLSpecifierNodeBase implements IMXMLPr
     }
 
     void initializeDefaultProperty(MXMLTreeBuilder builder, IVariableDefinition defaultPropertyDefinition,
-                                   List<IMXMLUnitData> contentUnits)
+                                   IMXMLTagData parentTag, List<IMXMLUnitData> contentUnits)
     {
         RoyaleProject project = builder.getProject();
 
@@ -359,15 +372,21 @@ class MXMLPropertySpecifierNode extends MXMLSpecifierNodeBase implements IMXMLPr
             ((MXMLDeferredInstanceNode)instanceNode).initializeDefaultProperty(
                     builder, defaultPropertyDefinition, contentUnits);
         }
-        else if ((propertyTypeName.equals(IASLanguageConstants.Array) && 
-                oneChildIsNotArray(builder, contentUnits)) ||
-                (propertyTypeName.equals(IASLanguageConstants.Object) && contentUnits.size() > 1))
+        else if (propertyTypeName.equals(IASLanguageConstants.Array) && 
+                oneChildIsNotArray(builder, contentUnits))
         {
             // Create an implicit array node.
             instanceNode = new MXMLArrayNode(this);
             ((MXMLArrayNode)instanceNode).initializeDefaultProperty(
                     builder, defaultPropertyDefinition, contentUnits);
         }
+        else if (propertyTypeName.equals(IASLanguageConstants.Object))
+        {
+            // Create an implicit Object node.
+            instanceNode = new MXMLObjectNode(this);
+            ((MXMLObjectNode)instanceNode).initialize(
+                    builder, parentTag, contentUnits, createNodeInfo(builder));
+        }
         else if (propertyTypeName.contains(IASLanguageConstants.Vector + ".<") && 
                 oneChildIsNotVector(builder, contentUnits))
         {


[royale-compiler] 04/08: add support for RemoteObject

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

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

commit 39d58aa7bdadb7766227cce4d9ed918a290f8cf1
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Oct 9 15:35:53 2018 -0700

    add support for RemoteObject
---
 .../royale/compiler/codegen/mxml/IMXMLEmitter.java |   8 ++
 .../internal/codegen/mxml/MXMLBlockWalker.java     |  20 ++++
 .../internal/codegen/mxml/MXMLEmitter.java         |  14 +++
 .../codegen/mxml/royale/MXMLRoyaleEmitter.java     | 120 +++++++++++++++++++++
 .../internal/visitor/mxml/MXMLNodeSwitch.java      |  10 +-
 .../compiler/visitor/mxml/IMXMLBlockVisitor.java   |   8 ++
 6 files changed, 178 insertions(+), 2 deletions(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/codegen/mxml/IMXMLEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/codegen/mxml/IMXMLEmitter.java
index 38b5082..956384c 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/codegen/mxml/IMXMLEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/codegen/mxml/IMXMLEmitter.java
@@ -40,6 +40,8 @@ import org.apache.royale.compiler.tree.mxml.IMXMLMetadataNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLNumberNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLObjectNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectMethodNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLScriptNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLStyleSpecifierNode;
@@ -137,4 +139,10 @@ public interface IMXMLEmitter extends IEmitter
     
     void emitDatabinding(IMXMLDataBindingNode node);
 
+    //--------------------------------------------------------------------------
+
+    void emitRemoteObjectMethod(IMXMLRemoteObjectMethodNode node);
+
+	void emitRemoteObject(IMXMLRemoteObjectNode node);
+
 }
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/MXMLBlockWalker.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/MXMLBlockWalker.java
index b6d9af0..8a1dbab 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/MXMLBlockWalker.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/MXMLBlockWalker.java
@@ -50,6 +50,8 @@ import org.apache.royale.compiler.tree.mxml.IMXMLNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLNumberNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLObjectNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectMethodNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLScriptNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLStyleNode;
@@ -441,10 +443,28 @@ public class MXMLBlockWalker implements IMXMLBlockVisitor, IMXMLBlockWalker
     }
     
     //--------------------------------------------------------------------------
+    
+    @Override
+    public void visitRemoteObjectMethod(IMXMLRemoteObjectMethodNode node)
+    {
+        debug("visitRemoteObjectMethod()");
+        
+        mxmlEmitter.emitRemoteObjectMethod(node);
+    }
+    
+	@Override
+	public void visitRemoteObject(IMXMLRemoteObjectNode node) {
+        debug("visitRemoteObjectMethod()");
+        
+        mxmlEmitter.emitRemoteObject(node);		
+	}
+    
+    //--------------------------------------------------------------------------
 
     protected void debug(String message)
     {
         //System.out.println(message);
     }
 
+
 }
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/MXMLEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/MXMLEmitter.java
index 22c73be..2027827 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/MXMLEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/MXMLEmitter.java
@@ -48,6 +48,8 @@ import org.apache.royale.compiler.tree.mxml.IMXMLNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLNumberNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLObjectNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectMethodNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLScriptNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLStyleSpecifierNode;
@@ -421,5 +423,17 @@ public class MXMLEmitter extends Emitter implements IMXMLEmitter
     {
     	// ToDo (erikdebruin): implement databinding output
     }
+
+	@Override
+	public void emitRemoteObjectMethod(IMXMLRemoteObjectMethodNode node) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void emitRemoteObject(IMXMLRemoteObjectNode node) {
+		// TODO Auto-generated method stub
+		
+	}
     
 }
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
index fcf3194..5506a11 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
@@ -20,6 +20,10 @@
 package org.apache.royale.compiler.internal.codegen.mxml.royale;
 
 
+import static org.apache.royale.abc.ABCConstants.OP_newarray;
+import static org.apache.royale.abc.ABCConstants.OP_pushstring;
+import static org.apache.royale.abc.ABCConstants.OP_pushtrue;
+
 import java.io.File;
 import java.io.FilterWriter;
 import java.util.ArrayList;
@@ -3116,4 +3120,120 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
 		return ((RoyaleJSProject)project).isExternalLinkage(cu);
 	}
 
+	@Override
+	public void emitRemoteObjectMethod(IMXMLRemoteObjectMethodNode node) {
+        MXMLDescriptorSpecifier currentInstance = getCurrentDescriptor("i");
+        String propName = null;
+        int l = node.getChildCount();
+        for (int k = 0; k < l; k++)
+        {
+        	IASNode child = node.getChild(k);
+        	if (child.getNodeID() == ASTNodeID.MXMLPropertySpecifierID)
+        	{
+        		IMXMLPropertySpecifierNode propNode = (IMXMLPropertySpecifierNode)child;
+        		if (propNode.getName().equals("name"))
+        		{
+        			// assume StringNode with LiteralNode
+        			IMXMLStringNode literalNode = (IMXMLStringNode)propNode.getChild(0);
+        			propName = literalNode.getValue();
+        			break;
+        		}
+        	}
+        }
+    	MXMLDescriptorSpecifier propertySpecifier = new MXMLDescriptorSpecifier();
+    	propertySpecifier.isProperty = true;
+    	propertySpecifier.name = propName;
+    	propertySpecifier.parent = currentInstance;
+    	currentInstance.propertySpecifiers.add(propertySpecifier);
+        moveDown(false, null, propertySpecifier);
+
+		emitInstance(node);
+		
+		moveUp(false, false);
+    	// build out the argument list if any
+    	int n = node.getChildCount();
+    	for (int i = 0; i < n; i++)
+    	{
+    		IASNode childNode = node.getChild(i);
+    		if (childNode.getNodeID() == ASTNodeID.MXMLPropertySpecifierID)
+    		{
+    			IMXMLPropertySpecifierNode propNode = (IMXMLPropertySpecifierNode)childNode;
+    			if (propNode.getName().equals("arguments"))
+    			{
+    				ArrayList<String> argList = new ArrayList<String>();
+    				childNode = propNode.getChild(0); // this is an MXMLObjectNode
+    				n = childNode.getChildCount();
+    				for (i = 0; i < n; i++)
+    				{
+    					IASNode argNode = childNode.getChild(i);
+    					propNode = (IMXMLPropertySpecifierNode)argNode;
+    					argList.add(propNode.getName());
+    				}
+    				if (argList.size() > 0)
+    				{
+    					StringBuilder list = new StringBuilder();
+    					list.append("[");
+    					int m = argList.size();
+    					for (int j = 0; j < m; j++)
+    					{
+    						if (j > 0)
+    							list.append(",");
+    						list.append("'" + argList.get(j) + "'");
+    					}
+    					list.append("]");
+    					
+    			        MXMLDescriptorSpecifier operationInstance = propertySpecifier.propertySpecifiers.get(0);
+
+    			        MXMLDescriptorSpecifier argListSpecifier = new MXMLDescriptorSpecifier();
+    			        argListSpecifier.isProperty = true;
+    			        argListSpecifier.name = "argumentList";
+    			        argListSpecifier.parent = operationInstance;
+    			        argListSpecifier.value = list.toString();
+				        if (operationInstance != null)
+				        	operationInstance.propertySpecifiers.add(argListSpecifier);
+    				}
+    				break;
+    			}
+    		}
+    	}    	
+	}
+
+	@Override
+	public void emitRemoteObject(IMXMLRemoteObjectNode node) {
+		emitInstance(node);
+		// now search for Operations, and add an Object that contains them
+		int n = node.getChildCount();
+		MXMLDescriptorSpecifier objectSpecifier = null;
+		MXMLDescriptorSpecifier propertySpecifier = null;
+		for (int i = 0; i < n; i++)
+		{
+			IASNode child = node.getChild(i);
+			if (child.getNodeID() == ASTNodeID.MXMLRemoteObjectMethodID)
+			{
+		        MXMLDescriptorSpecifier currentPropertySpecifier = getCurrentDescriptor("ps");
+		        MXMLDescriptorSpecifier currentInstance = 
+		        	currentPropertySpecifier.propertySpecifiers.get(currentPropertySpecifier.propertySpecifiers.size() - 1);
+
+		        if (objectSpecifier == null)
+		        {
+		        	propertySpecifier = new MXMLDescriptorSpecifier();
+		        	propertySpecifier.isProperty = true;
+		        	propertySpecifier.name = "operations";
+		        	propertySpecifier.parent = currentInstance;
+
+			        if (currentInstance != null)
+			        	currentInstance.propertySpecifiers.add(propertySpecifier);
+			        objectSpecifier = new MXMLDescriptorSpecifier();
+			        objectSpecifier.isProperty = false;
+			        objectSpecifier.name = formatQualifiedName(IASLanguageConstants.Object);
+			        objectSpecifier.parent = propertySpecifier;
+			        propertySpecifier.propertySpecifiers.add(objectSpecifier);
+			        instances.add(objectSpecifier);
+		        }
+	            moveDown(false, objectSpecifier, null);
+                getMXMLWalker().walk(child); // RemoteObjectMethod
+	            moveUp(false, true);
+			}			
+		}
+	}
 }
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/visitor/mxml/MXMLNodeSwitch.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
index 24b317e..5caf3ef 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
@@ -40,6 +40,8 @@ import org.apache.royale.compiler.tree.mxml.IMXMLMetadataNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLNumberNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLObjectNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectMethodNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLScriptNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLStyleNode;
@@ -156,6 +158,12 @@ public class MXMLNodeSwitch implements IASNodeStrategy
         case MXMLFunctionID:
             visitor.visitInstance((IMXMLInstanceNode) node);
             break;
+        case MXMLRemoteObjectID:
+            visitor.visitRemoteObject((IMXMLRemoteObjectNode) node);
+            break;
+        case MXMLRemoteObjectMethodID:
+            visitor.visitRemoteObjectMethod((IMXMLRemoteObjectMethodNode) node);
+            break;
         case MXMLApplicationID:
         case MXMLBindingAttributeID:
         case MXMLClassID:
@@ -172,8 +180,6 @@ public class MXMLNodeSwitch implements IASNodeStrategy
         case MXMLModelRootID:
         case MXMLPrivateID:
         case MXMLRegExpID:
-        case MXMLRemoteObjectID:
-        case MXMLRemoteObjectMethodID:
         case MXMLReparentID:
         //case MXMLRepeaterID:
         case MXMLResourceID:
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/visitor/mxml/IMXMLBlockVisitor.java b/compiler-jx/src/main/java/org/apache/royale/compiler/visitor/mxml/IMXMLBlockVisitor.java
index 756bc12..4507a9c 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/visitor/mxml/IMXMLBlockVisitor.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/visitor/mxml/IMXMLBlockVisitor.java
@@ -40,6 +40,8 @@ import org.apache.royale.compiler.tree.mxml.IMXMLMetadataNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLNumberNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLObjectNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectMethodNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLScriptNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLStyleNode;
@@ -135,4 +137,10 @@ public interface IMXMLBlockVisitor extends IBlockVisitor
     //--------------------------------------------------------------------------
     
     void visitObject(IMXMLObjectNode node);
+    
+    //--------------------------------------------------------------------------
+    
+    void visitRemoteObjectMethod(IMXMLRemoteObjectMethodNode node);
+
+	void visitRemoteObject(IMXMLRemoteObjectNode node);
 }


[royale-compiler] 07/08: oops, wrong name

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

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

commit 79f8458d448f7b64bdc6f9b8a4fe2426c51c50b3
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Oct 10 09:54:30 2018 -0700

    oops, wrong name
---
 .../compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
index 5506a11..1fa01e3 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
@@ -1916,7 +1916,7 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
         {
         	effectiveId = node.getEffectiveID();
         	if (effectiveId == null)
-        		effectiveId = MXMLRoyaleEmitterTokens.ID_PREFIX.getToken() + idCounter++;
+        		effectiveId = node.getClassDefinitionNode().getGeneratedID(node);
         }
 
         MXMLDescriptorSpecifier currentInstance = new MXMLDescriptorSpecifier();
@@ -3186,7 +3186,7 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
 
     			        MXMLDescriptorSpecifier argListSpecifier = new MXMLDescriptorSpecifier();
     			        argListSpecifier.isProperty = true;
-    			        argListSpecifier.name = "argumentList";
+    			        argListSpecifier.name = "argumentNames";
     			        argListSpecifier.parent = operationInstance;
     			        argListSpecifier.value = list.toString();
 				        if (operationInstance != null)


[royale-compiler] 06/08: fix namespace output

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

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

commit ddf67711399d15941eb936b9c44e0f4ff58992d1
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Oct 9 18:34:28 2018 -0700

    fix namespace output
---
 .../royale/compiler/internal/codegen/js/jx/MemberAccessEmitter.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 b7a577c..e74820c 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
@@ -170,7 +170,7 @@ public class MemberAccessEmitter extends JSSubEmitter implements
         		write(ASEmitterTokens.SPACE);
         		write(IASLanguageConstants.QName);
         		write(ASEmitterTokens.PAREN_OPEN);
-        		write(d.getBaseName());
+	    		write(fjs.formatQualifiedName(d.getQualifiedName()));
         		write(ASEmitterTokens.COMMA);
         		write(ASEmitterTokens.SPACE);
         		write(ASEmitterTokens.SINGLE_QUOTE);
@@ -211,7 +211,7 @@ public class MemberAccessEmitter extends JSSubEmitter implements
 	    		write(ASEmitterTokens.SPACE);
 	    		write(IASLanguageConstants.QName);
 	    		write(ASEmitterTokens.PAREN_OPEN);
-	    		write(fjs.formatQualifiedName(d.getBaseName()));
+	    		write(fjs.formatQualifiedName(d.getQualifiedName()));
 	    		write(ASEmitterTokens.COMMA);
 	    		write(ASEmitterTokens.SPACE);
 	    		write(ASEmitterTokens.SINGLE_QUOTE);


[royale-compiler] 05/08: fix proxy output

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

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

commit f7a90aef1dc0bcc086938a5b8a116f8b0b850eff
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Oct 9 18:34:11 2018 -0700

    fix proxy output
---
 .../royale/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index 4aa7024..d24da15 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -208,7 +208,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
 	                    return;
                 	}
                 }
-                else if (((JSRoyaleEmitter)getEmitter()).isProxy((MemberAccessExpressionNode)leftSide))
+                else if (((JSRoyaleEmitter)getEmitter()).isProxy(((MemberAccessExpressionNode)leftSide).getLeftOperandNode()) && leftDef == null)
                 {
                 	MemberAccessExpressionNode proxyNode = (MemberAccessExpressionNode)leftSide;
                 	if (node.getNodeID() == ASTNodeID.Op_AssignId)


[royale-compiler] 08/08: also suppress binding warnings if proxy

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

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

commit d8f8b832a99da51e224565b2e2017977e193e90f
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Oct 10 12:28:54 2018 -0700

    also suppress binding warnings if proxy
---
 .../internal/codegen/databinding/WatcherAnalyzer.java      | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/codegen/databinding/WatcherAnalyzer.java b/compiler/src/main/java/org/apache/royale/compiler/internal/codegen/databinding/WatcherAnalyzer.java
index 4fe0d22..4ef1189 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/codegen/databinding/WatcherAnalyzer.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/codegen/databinding/WatcherAnalyzer.java
@@ -217,18 +217,28 @@ public class WatcherAnalyzer
                 ITypeDefinition leftType= leftDef.resolveType(project);  
                 RoyaleProject project = (RoyaleProject)this.project;
                 String objectProxyClass = project.getObjectProxyClass();
-                boolean isProxy = leftType==null ? false : leftType.isInstanceOf(objectProxyClass, project);
+                boolean isObjectProxy = leftType==null ? false : leftType.isInstanceOf(objectProxyClass, project);
     
                 // If we are proxy.prop, we set this info into the parse state. This does two things:
                 //      1) tells downstream properties that they can be dynamic, and hence don't need
                 //          to be resolvable.
                 //      2) Stores off the event names from the proxy so that the chained property watchers
                 //          can use the info
-                if (isProxy)
+                if (isObjectProxy)
                 {
                     state.isObjectProxyExpression = true;
                     state.objectProxyEventNames = leftType.getBindableEventNames();
                 }
+                else
+                {
+                    String proxyClass = project.getProxyBaseClass();
+                    boolean isProxy = leftType==null ? false : leftType.isInstanceOf(proxyClass, project);
+                    if (isProxy)
+                    {
+                        state.isObjectProxyExpression = true;
+                        state.objectProxyEventNames = leftType.getBindableEventNames();
+                    }
+                }
             }
             doAnalyze(left, state);
             doAnalyze(right, state); 


[royale-compiler] 02/08: be smarter about what to generate. Look for a single actual tag among the whitespace

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

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

commit d24a4e6b33eb4df219f56d2ab36d013690c37794
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Oct 8 22:41:05 2018 -0700

    be smarter about what to generate.  Look for a single actual tag among the whitespace
---
 .../tree/mxml/MXMLPropertySpecifierNode.java       | 24 +++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
index acc8641..e27713a 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
@@ -362,6 +362,24 @@ class MXMLPropertySpecifierNode extends MXMLSpecifierNodeBase implements IMXMLPr
         setLocation(builder, contentUnits);
 
         String propertyTypeName = getPropertyTypeName(builder);
+        
+        int numChildTags = 0;
+        IMXMLTagData oneAndOnlyChildTag = null;
+    	for (IMXMLUnitData unit : contentUnits)
+    	{
+    		if (unit instanceof IMXMLTagData)
+    		{
+    			oneAndOnlyChildTag = (IMXMLTagData)unit;
+    			numChildTags++;
+    		}
+    	}
+    	boolean oneAndOnlyChildIsClass = false;
+    	if (numChildTags == 1)
+    	{
+            IDefinition definition = builder.getFileScope().resolveTagToDefinition(oneAndOnlyChildTag);
+            if (definition instanceof ClassDefinition)
+                oneAndOnlyChildIsClass = true;    		
+    	}
 
         // If the property is of type IDeferredInstance or ITransientDeferredInstance,
         // create an implicit MXMLDeferredInstanceNode.
@@ -380,7 +398,7 @@ class MXMLPropertySpecifierNode extends MXMLSpecifierNodeBase implements IMXMLPr
             ((MXMLArrayNode)instanceNode).initializeDefaultProperty(
                     builder, defaultPropertyDefinition, contentUnits);
         }
-        else if (propertyTypeName.equals(IASLanguageConstants.Object))
+        else if (propertyTypeName.equals(IASLanguageConstants.Object) && !oneAndOnlyChildIsClass)
         {
             // Create an implicit Object node.
             instanceNode = new MXMLObjectNode(this);
@@ -395,9 +413,9 @@ class MXMLPropertySpecifierNode extends MXMLSpecifierNodeBase implements IMXMLPr
             ((MXMLVectorNode)instanceNode).initializeDefaultProperty(
                     builder, defaultPropertyDefinition, contentUnits);
         }
-        else if (contentUnits.size() == 1 && contentUnits.get(0) instanceof IMXMLTagData)
+        else if (oneAndOnlyChildTag != null)
         {
-            IMXMLTagData tag = (IMXMLTagData)contentUnits.get(0);
+            IMXMLTagData tag = oneAndOnlyChildTag;
             IDefinition definition = builder.getFileScope().resolveTagToDefinition(tag);
             if (definition instanceof ClassDefinition)
             {


[royale-compiler] 03/08: more tweaking of codegen for remoteobject

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

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

commit dee493d017bf187ed9632076bee54a967917deeb
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Oct 9 09:47:38 2018 -0700

    more tweaking of codegen for remoteobject
---
 .../as/codegen/MXMLClassDirectiveProcessor.java    | 63 ++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java b/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
index 9ad5f6d..b92da21 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
@@ -100,6 +100,7 @@ import static org.apache.royale.compiler.mxml.IMXMLTypeConstants.SET_DOCUMENT_DE
 import static org.apache.royale.compiler.mxml.IMXMLTypeConstants.SET_STYLE_CALL_OPERANDS;
 
 import java.util.ArrayDeque;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Deque;
 import java.util.EnumMap;
@@ -1881,6 +1882,9 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
         if (context.hasBeads)
             numProperties += 1;
         
+        int numOperations = context.getCounter(IL.WEB_SERVICE_OPERATIONS_OR_REMOTE_OBJECT_METHODS);
+        if (numOperations > 0)
+        	numProperties += 1;
         if (newCodeGen && addCounters)
             context.pushNumericConstant(numProperties);
         // Adds code such as
@@ -1890,6 +1894,20 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
         if (context.hasModel)
             context.transfer(IL.MXML_MODEL_PROPERTIES);
         context.transfer(IL.PROPERTIES);
+        if (numOperations > 0)
+        {
+            context.addInstruction(OP_pushstring, "operations");
+            context.addInstruction(OP_pushfalse);
+            context.addInstruction(OP_findpropstrict, IMXMLTypeConstants.NAME_OBJECT);
+            context.addInstruction(OP_getproperty, IMXMLTypeConstants.NAME_OBJECT);
+            context.pushNumericConstant(numOperations);
+        	context.transfer(IL.WEB_SERVICE_OPERATIONS_OR_REMOTE_OBJECT_METHODS);
+            context.pushNumericConstant(0);
+            context.pushNumericConstant(0);
+            context.pushNumericConstant(0);
+            context.addInstruction(OP_pushnull);
+            context.addInstruction(OP_newarray, numOperations * 3 + 6);      
+        }
         if (context.hasBeads)
             context.transfer(IL.MXML_BEAD_PROPERTIES);
         
@@ -2968,6 +2986,39 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
         // If 'name' is undefined, the WebService node will report problem.
         if (!Strings.isNullOrEmpty(name))
         {
+        	// build out the argument list if any
+        	int n = node.getChildCount();
+        	for (int i = 0; i < n; i++)
+        	{
+        		IASNode childNode = node.getChild(i);
+        		if (childNode.getNodeID() == ASTNodeID.MXMLPropertySpecifierID)
+        		{
+        			IMXMLPropertySpecifierNode propNode = (IMXMLPropertySpecifierNode)childNode;
+        			if (propNode.getName().equals("arguments"))
+        			{
+        				ArrayList<String> argList = new ArrayList<String>();
+        				childNode = propNode.getChild(0); // this is an MXMLObjectNode
+        				n = childNode.getChildCount();
+        				for (i = 0; i < n; i++)
+        				{
+        					IASNode argNode = childNode.getChild(i);
+        					propNode = (IMXMLPropertySpecifierNode)argNode;
+        					argList.add(propNode.getName());
+        				}
+        				if (argList.size() > 0)
+        				{
+        		            context.startUsing(IL.PROPERTIES);
+        		            context.addInstruction(OP_pushstring, "argumentNames");
+        		            context.addInstruction(OP_pushtrue);
+        		            for (String s : argList)
+            		            context.addInstruction(OP_pushstring, s);
+        	                context.addInstruction(OP_newarray, argList.size());      
+        		            context.stopUsing(IL.PROPERTIES, 1);        					
+        				}
+        				break;
+        			}
+        		}
+        	}
             context.startUsing(IL.WEB_SERVICE_OPERATIONS_OR_REMOTE_OBJECT_METHODS);
             context.addInstruction(OP_pushstring, name);
             processMXMLInstance(node, context);
@@ -3016,9 +3067,21 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
         traverse(objectNode, context);
         
         int numElements = context.getCounter(IL.PROPERTIES);
+        String id = objectNode.getEffectiveID();
+        if (id != null)
+        	numElements++;
         if (newCodeGen && !context.makingSimpleArray)
             context.pushNumericConstant(numElements);
         context.transfer(IL.PROPERTIES);
+        if (id != null)
+        {
+        	if (id.startsWith("#"))
+        		context.addInstruction(OP_pushstring, "_id");
+        	else
+        		context.addInstruction(OP_pushstring, "id");
+            context.addInstruction(OP_pushtrue);
+            context.addInstruction(OP_pushstring, id);
+        }
         
         if (!newCodeGen || context.makingSimpleArray)
         {