flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [02/15] git commit: [flex-falcon] [refs/heads/develop] - look everywhere for binding events
Date Mon, 26 Aug 2013 21:30:58 GMT
look everywhere for binding events


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

Branch: refs/heads/develop
Commit: bbea11cb8243b12e9f4d4cce04dcc96294c09c52
Parents: 9a19de8
Author: Alex Harui <aharui@apache.org>
Authored: Thu Jul 25 06:30:06 2013 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Jul 25 06:30:06 2013 -0700

----------------------------------------------------------------------
 .../codegen/databinding/WatcherAnalyzer.java    |  2 +-
 .../codegen/databinding/WatcherInfoBase.java    | 56 ++++++++++++++++----
 2 files changed, 47 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bbea11cb/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/WatcherAnalyzer.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/WatcherAnalyzer.java
b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/WatcherAnalyzer.java
index 5d98d10..e8291ca 100644
--- a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/WatcherAnalyzer.java
+++ b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/WatcherAnalyzer.java
@@ -333,7 +333,7 @@ public class WatcherAnalyzer
                 if (def != state.functionCallNameDefintion)
                     return;
             }
-            eventNames = WatcherInfoBase.getEventNamesFromDefinition(def, problems, node);
+            eventNames = WatcherInfoBase.getEventNamesFromDefinition(def, problems, node,
project);
             name = def.getBaseName();
             id = def;
         }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bbea11cb/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/WatcherInfoBase.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/WatcherInfoBase.java
b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/WatcherInfoBase.java
index 0bb44b5..53bbb8c 100644
--- a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/WatcherInfoBase.java
+++ b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/WatcherInfoBase.java
@@ -28,12 +28,17 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
+import org.apache.flex.compiler.definitions.IClassDefinition;
 import org.apache.flex.compiler.definitions.IConstantDefinition;
 import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.internal.as.codegen.BindableHelper;
+import org.apache.flex.compiler.internal.semantics.SemanticUtils;
+import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.problems.MXMLDatabindingSourceNotBindableProblem;
+import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IIdentifierNode;
 
 /**
  * base class for the different watcher info classes
@@ -191,27 +196,58 @@ public class WatcherInfoBase
         return ret;
     }
     
-    static List<String> getEventNamesFromDefinition(IDefinition def, Collection<ICompilerProblem>
problems, IASNode sourceNode)
+    static List<String> getEventNamesFromDefinition(IDefinition def, Collection<ICompilerProblem>
problems, IIdentifierNode sourceNode, ICompilerProject project)
     {
         List<String> ret = new LinkedList<String>();
         
         assert ! (def instanceof IConstantDefinition);  // don't call with constants, we
don't know what to do with them
     
-        if (def.isBindable())
+        Collection<IDefinition> defs = SemanticUtils.getPropertiesByNameForMemberAccess(((IdentifierNode)sourceNode).getASScope(),

+                                def.getBaseName(), project);
+        if (defs.size() == 0)
+            defs.add(def);
+        
+        IDefinition parent = def.getParent();
+        if (parent instanceof IClassDefinition)
         {
-            List<String> names = def.getBindableEventNames();
-            if (names.isEmpty())
+            while (parent != null)
             {
-               ret.add(BindableHelper.PROPERTY_CHANGE);       // TODO: should this be on
the tag?
-                                                              // this is logged as CMP-1169
+                Collection<IDefinition> moredefs = SemanticUtils.getPropertiesByNameForMemberAccess(
+                                                                    ((IClassDefinition)parent).getContainedScope(),
+                                                                    def.getBaseName(), project);
+                if (moredefs != null)
+                {
+                    defs.addAll(moredefs);
+                }
+                parent = ((IClassDefinition)parent).resolveBaseClass(project);
             }
-            else
+        }
+        
+        boolean wasBindable = false;
+        for (IDefinition d : defs)
+        {
+            if (d.isBindable())
             {
-               ret.addAll(names);
+                wasBindable = true;
+                List<String> names = d.getBindableEventNames();
+                if (names.isEmpty())
+                {
+                    if (!ret.contains(BindableHelper.PROPERTY_CHANGE))
+                        ret.add(BindableHelper.PROPERTY_CHANGE);       // TODO: should this
be on the tag?
+                                                                       // this is logged
as CMP-1169
+                }
+                else
+                {
+                    for (String name : names)
+                    {
+                        if (!ret.contains(name))
+                            ret.add(name);
+                    }
+                }
             }
         }
-
-        else 
+        
+        if (!wasBindable)
         {
             String s = def.getBaseName();
             problems.add( new MXMLDatabindingSourceNotBindableProblem(sourceNode, s));


Mime
View raw message