flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject git commit: [flex-falcon] [refs/heads/develop] - convert more binding expressions into simple bindings
Date Sun, 09 Oct 2016 05:28:21 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 73fd82c7c -> 09b76c2f6


convert more binding expressions into simple bindings


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

Branch: refs/heads/develop
Commit: 09b76c2f6ec052445c217b5324662996c472d34b
Parents: 73fd82c
Author: Alex Harui <aharui@apache.org>
Authored: Sat Oct 8 22:28:02 2016 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Sat Oct 8 22:28:02 2016 -0700

----------------------------------------------------------------------
 .../codegen/databinding/BindingInfo.java        | 43 ++++++++++++++++++++
 .../databinding/MXMLBindingDirectiveHelper.java |  2 +-
 2 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/09b76c2f/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/BindingInfo.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/BindingInfo.java
b/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/BindingInfo.java
index 087c178..04ef899 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/BindingInfo.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/BindingInfo.java
@@ -24,6 +24,7 @@ import java.util.List;
 
 
 import org.apache.flex.compiler.common.DependencyType;
+import org.apache.flex.compiler.definitions.IAccessorDefinition;
 import org.apache.flex.compiler.definitions.IConstantDefinition;
 import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.definitions.IVariableDefinition;
@@ -36,10 +37,12 @@ import org.apache.flex.compiler.internal.definitions.ClassDefinition;
 import org.apache.flex.compiler.internal.definitions.NamespaceDefinition;
 import org.apache.flex.compiler.internal.scopes.ASScope;
 import org.apache.flex.compiler.internal.scopes.TypeScope;
+import org.apache.flex.compiler.internal.tree.as.MemberAccessExpressionNode;
 import org.apache.flex.compiler.internal.tree.as.NodeBase;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IFunctionCallNode;
 import org.apache.flex.compiler.tree.as.IIdentifierNode;
 import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLBindingAttributeNode;
@@ -478,5 +481,45 @@ public class BindingInfo implements Comparable<BindingInfo>
                     }
             }
         }
+        else if (expressionNodeForGetter instanceof MemberAccessExpressionNode)
+        {
+        	MemberAccessExpressionNode mae = (MemberAccessExpressionNode)expressionNodeForGetter;
+            IDefinition def = mae.resolve(project);
+            if (def.isPublic() && 
+            		(def instanceof IAccessorDefinition ||
+            		 def instanceof IConstantDefinition ||
+            		 def instanceof IVariableDefinition))
+            {
+            	IExpressionNode leftSide = mae.getLeftOperandNode();
+            	if (leftSide instanceof IIdentifierNode)
+            	{
+            		IDefinition leftDef = leftSide.resolve(project);
+		        	if (leftDef.isPublic())
+		        	{
+		        		sourceString = leftDef.getBaseName() + "." + def.getBaseName();
+		                isSimplePublicProperty = true;            		
+		        	}
+            	}
+            	else if (leftSide instanceof IFunctionCallNode)
+            	{
+            		IFunctionCallNode fun = (IFunctionCallNode)leftSide;
+        			IExpressionNode[] args = fun.getArgumentNodes();
+        			if (args.length == 1)
+        			{
+        				IExpressionNode arg = args[0];
+        				if (arg instanceof IIdentifierNode)
+        				{
+        					IDefinition argDef = arg.resolve(project);
+        					if (argDef.isPublic())
+        					{
+        		        		sourceString = argDef.getBaseName() + "." + def.getBaseName();
+        		                isSimplePublicProperty = true;            		
+        					}
+        				}
+        			}
+            	}
+            }
+        }
+
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/09b76c2f/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/MXMLBindingDirectiveHelper.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/MXMLBindingDirectiveHelper.java
b/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/MXMLBindingDirectiveHelper.java
index b023ba3..2551260 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/MXMLBindingDirectiveHelper.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/MXMLBindingDirectiveHelper.java
@@ -164,7 +164,7 @@ public class MXMLBindingDirectiveHelper
         }
         else
         {
-            if (host.getProject().isFlex())
+            if (host.getProject().resolveQNameToDefinition(host.getProject().getBindingManagerClass())
!= null)
             {
                 makeSpecialMemberVariablesForBinding();
                 isFlexSDK = true;


Mime
View raw message