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/12/03 09:14:00 UTC

[royale-compiler] branch develop updated: try to eliminate duplicate keys

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


The following commit(s) were added to refs/heads/develop by this push:
     new 64dc386  try to eliminate duplicate keys
64dc386 is described below

commit 64dc386855108d3e37f3e958f6ca7719e00c4f7e
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Dec 3 01:13:45 2018 -0800

    try to eliminate duplicate keys
---
 .../internal/codegen/mxml/royale/MXMLRoyaleEmitter.java    | 14 ++++++++++++--
 1 file changed, 12 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 47aee49..7e76ba3 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
@@ -2043,7 +2043,7 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
             propertiesTree.propertySpecifiers.add(currentInstance);
         }
 
-        instances.add(currentInstance);
+        addInstanceIfNeeded(instances, currentInstance);
 
         IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
         if (pnodes != null)
@@ -2138,7 +2138,17 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
         }
     }
 
-    public void emitPropertyOverride(IMXMLPropertySpecifierNode propertyNode)
+    private void addInstanceIfNeeded(
+			ArrayList<MXMLDescriptorSpecifier> instances2,
+			MXMLDescriptorSpecifier currentInstance) {
+    	for (MXMLDescriptorSpecifier instance : instances2)
+    		if (instance.id != null && currentInstance.id != null && instance.id.equals(currentInstance.id))
+    			return;
+        instances.add(currentInstance);
+
+	}
+
+	public void emitPropertyOverride(IMXMLPropertySpecifierNode propertyNode)
     {
         RoyaleProject project = (RoyaleProject) getMXMLWalker().getProject();
         Name propertyOverride = project.getPropertyOverrideClassName();