You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/12/09 22:27:06 UTC

git commit: [flex-falcon] [refs/heads/develop] - id get/set was messed up by subdocuments

Repository: flex-falcon
Updated Branches:
  refs/heads/develop bfb8e0bba -> 8412f4100


id get/set was messed up by subdocuments


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/8412f410
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/8412f410
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/8412f410

Branch: refs/heads/develop
Commit: 8412f41004fa74d0f50cf450d98f964c5bbe3c66
Parents: bfb8e0b
Author: Alex Harui <ah...@apache.org>
Authored: Tue Dec 9 13:26:26 2014 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Dec 9 13:26:26 2014 -0800

----------------------------------------------------------------------
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java     | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8412f410/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 5cf3a17..4fadf08 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -90,13 +90,17 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         IMXMLFlexJSEmitter
 {
 
+	// the instances in a container
     private ArrayList<MXMLDescriptorSpecifier> currentInstances;
     private ArrayList<MXMLDescriptorSpecifier> currentPropertySpecifiers;
     private ArrayList<MXMLDescriptorSpecifier> descriptorTree;
     private MXMLDescriptorSpecifier propertiesTree;
     private MXMLDescriptorSpecifier currentStateOverrides;
     private ArrayList<MXMLEventSpecifier> events;
+    // all instances in the current document or subdocument
     private ArrayList<MXMLDescriptorSpecifier> instances;
+    // all instances in the document AND its subdocuments
+    private ArrayList<MXMLDescriptorSpecifier> allInstances = new ArrayList<MXMLDescriptorSpecifier>();
     private ArrayList<MXMLScriptSpecifier> scripts;
     //private ArrayList<MXMLStyleSpecifier> styles;
 
@@ -220,6 +224,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         ArrayList<MXMLEventSpecifier> oldEvents;
         ArrayList<MXMLScriptSpecifier> oldScripts;
         ArrayList<MXMLDescriptorSpecifier> oldCurrentInstances;
+        ArrayList<MXMLDescriptorSpecifier> oldInstances;
         ArrayList<MXMLDescriptorSpecifier> oldCurrentPropertySpecifiers;
         int oldEventCounter;
         int oldIdCounter;
@@ -234,7 +239,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         inMXMLContent = false;
         oldEvents = events;
         events = new ArrayList<MXMLEventSpecifier>();
-        // we don't save these.  We want all requires to be generated at the top of the file
+        oldInstances = instances;
         instances = new ArrayList<MXMLDescriptorSpecifier>();
         oldScripts = scripts;
         scripts = new ArrayList<MXMLScriptSpecifier>();
@@ -291,6 +296,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         events = oldEvents;
         scripts = oldScripts;
         currentInstances = oldCurrentInstances;
+        allInstances.addAll(instances);
+        instances = oldInstances;
         currentPropertySpecifiers = oldCurrentPropertySpecifiers;
         eventCounter = oldEventCounter;
         idCounter = oldIdCounter;
@@ -1678,15 +1685,19 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         writeNewline(" */");
         writeNewline();
         
+        ArrayList<String> writtenInstances = new ArrayList<String>();
         emitHeaderLine(cname, true); // provide
         for (String subDocumentName : subDocumentNames)
+        {
             emitHeaderLine(subDocumentName, true);
+            writtenInstances.add(subDocumentName);
+        }
         writeNewline();
         emitHeaderLine(bcname);
-        ArrayList<String> writtenInstances = new ArrayList<String>();
         writtenInstances.add(cname); // make sure we don't add ourselves
         writtenInstances.add(bcname); // make sure we don't add the baseclass twice
-        for (MXMLDescriptorSpecifier instance : instances)
+        allInstances.addAll(0, instances);
+        for (MXMLDescriptorSpecifier instance : allInstances)
         {
             String name = instance.name;
             if (writtenInstances.indexOf(name) == -1)