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 2013/10/08 23:50:06 UTC

[06/14] git commit: [flex-falcon] [refs/heads/develop] - handle binding to non-public entities

handle binding to non-public entities


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

Branch: refs/heads/develop
Commit: 2ec7343c93848f22bbdf700525dfa8f929f92433
Parents: ad066de
Author: Alex Harui <ah...@apache.org>
Authored: Wed Oct 2 20:49:06 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Oct 8 13:50:57 2013 -0700

----------------------------------------------------------------------
 .../databinding/BindingDestinationMaker.java    | 35 +++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2ec7343c/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDestinationMaker.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDestinationMaker.java b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDestinationMaker.java
index 5740285..e68a42c 100644
--- a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDestinationMaker.java
+++ b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDestinationMaker.java
@@ -25,13 +25,28 @@ import java.util.LinkedList;
 
 import org.apache.flex.abc.instructionlist.InstructionList;
 import org.apache.flex.abc.semantics.Name;
+import org.apache.flex.abc.semantics.Namespace;
+import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.definitions.references.INamespaceReference;
+import org.apache.flex.compiler.internal.as.codegen.Binding;
 import org.apache.flex.compiler.internal.as.codegen.InstructionListNode;
+import org.apache.flex.compiler.internal.as.codegen.LexicalScope;
+import org.apache.flex.compiler.internal.as.codegen.MXMLClassDirectiveProcessor;
+import org.apache.flex.compiler.internal.definitions.DefinitionBase;
+import org.apache.flex.compiler.internal.definitions.NamespaceDefinition;
+import org.apache.flex.compiler.internal.definitions.SetterDefinition;
+import org.apache.flex.compiler.internal.definitions.VariableDefinition;
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.scopes.IASScope;
+import org.apache.flex.compiler.scopes.IDefinitionSet;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDataBindingNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLModelNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLModelPropertyNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLModelRootNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLSingleDataBindingNode;
 
 /**
  * Utility class for analyze binding destinations and making
@@ -65,7 +80,8 @@ public class BindingDestinationMaker
      * 
      * Do this by walking up and down the tree, building up instruction list
      */
-    public  static IExpressionNode makeDestinationFunctionInstructionList(IMXMLDataBindingNode dbnode)
+    public  static IExpressionNode makeDestinationFunctionInstructionList(IMXMLDataBindingNode dbnode,
+            MXMLClassDirectiveProcessor host)
     {   
         IExpressionNode ret = null;
         final IASNode parent = dbnode.getParent();
@@ -116,6 +132,23 @@ public class BindingDestinationMaker
 
            ret = new InstructionListNode(insns);    // Wrap the IL in a node and return it
         }
+        else if (parent instanceof IMXMLPropertySpecifierNode && dbnode instanceof IMXMLSingleDataBindingNode)
+        {
+            IMXMLPropertySpecifierNode psn = (IMXMLPropertySpecifierNode)parent;
+            IDefinition d = psn.getDefinition();
+            Name mname = ((DefinitionBase)d).getMName(host.getProject());
+            Binding b = host.getInstanceScope().getBinding(d);
+            INamespaceReference ns = psn.getDefinition().getNamespaceReference();
+            Namespace n = ns.resolveAETNamespace(host.getProject());
+            if (ns != NamespaceDefinition.getPublicNamespaceDefinition())
+            {
+                InstructionList insns = new InstructionList();
+                insns.addInstruction(OP_getlocal0);
+                insns.addInstruction(OP_getlocal1);
+                insns.addInstruction(OP_setproperty, b.getName());
+                ret = new InstructionListNode(insns);    // Wrap the IL in a node and return it
+            }
+        }
         return ret;   
     }