flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject svn commit: r1444917 - in /flex/falcon/trunk/compiler/src/org/apache/flex/compiler: internal/tree/mxml/MXMLInstanceNode.java tree/mxml/IMXMLInstanceNode.java
Date Mon, 11 Feb 2013 18:43:00 GMT
Author: aharui
Date: Mon Feb 11 18:43:00 2013
New Revision: 1444917

URL: http://svn.apache.org/r1444917
Log:
When array properties didn't have a sub-tag of <fx:Array>, the compiler injected an
Array node and re-traversed (which creates new child node instances).  However, if the child
nodes had id attributes, those were already registered with their old node instances so you
got a duplicate id error.  Add "equals" test that checks line number so we don't think it
is a duplicate if we see that a node was registered with the same line number.

Modified:
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNode.java
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/mxml/IMXMLInstanceNode.java

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNode.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNode.java?rev=1444917&r1=1444916&r2=1444917&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNode.java
(original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNode.java
Mon Feb 11 18:43:00 2013
@@ -212,7 +212,7 @@ class MXMLInstanceNode extends MXMLClass
         IMXMLInstanceNode previousNodeWithSameID =
                 ((MXMLClassDefinitionNode)getClassDefinitionNode()).addNodeWithID(value,
this);
 
-        if (previousNodeWithSameID != null)
+        if (previousNodeWithSameID != null && !isEqual(previousNodeWithSameID))
         {
             ICompilerProblem problem = new MXMLDuplicateIDProblem(attribute);
             builder.addProblem(problem);
@@ -421,4 +421,10 @@ class MXMLInstanceNode extends MXMLClass
 
         return true;
     }
+    
+    public boolean isEqual(IMXMLInstanceNode node)
+    {
+        return (node.getLine() == getLine() &&
+                node.getColumn() == getColumn());
+    }
 }

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/mxml/IMXMLInstanceNode.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/mxml/IMXMLInstanceNode.java?rev=1444917&r1=1444916&r2=1444917&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/mxml/IMXMLInstanceNode.java
(original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/mxml/IMXMLInstanceNode.java
Mon Feb 11 18:43:00 2013
@@ -82,4 +82,13 @@ public interface IMXMLInstanceNode exten
      * @return Either <code>"auto"</code> or <code>"never"</code>.
      */
     String getItemDestructionPolicy();
+    
+    /**
+     * If this node is the same.  When properties of type array
+     * don't have a child node of array, we insert an array
+     * and walk again which creates new instances of the same node.
+     * 
+     * @return <code>true</code> if node has same line number.
+     */
+    boolean isEqual(IMXMLInstanceNode node);
 }



Mime
View raw message