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] - Get JS binding data to match
Date Thu, 07 Nov 2013 00:54:08 GMT
Updated Branches:
  refs/heads/develop 7b9d0b416 -> 7b3260229


Get JS binding data to match


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

Branch: refs/heads/develop
Commit: 7b3260229465dad62dcdfb81b9fe231dbcd2847b
Parents: 7b9d0b4
Author: Alex Harui <aharui@apache.org>
Authored: Tue Nov 5 23:14:53 2013 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Wed Nov 6 07:15:11 2013 -0800

----------------------------------------------------------------------
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 41 +++++++++++++++-----
 1 file changed, 32 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7b326022/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 7669e81..444b26a 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
@@ -38,6 +38,7 @@ import org.apache.flex.compiler.internal.codegen.databinding.BindingDatabase;
 import org.apache.flex.compiler.internal.codegen.databinding.BindingInfo;
 import org.apache.flex.compiler.internal.codegen.databinding.FunctionWatcherInfo;
 import org.apache.flex.compiler.internal.codegen.databinding.PropertyWatcherInfo;
+import org.apache.flex.compiler.internal.codegen.databinding.StaticPropertyWatcherInfo;
 import org.apache.flex.compiler.internal.codegen.databinding.WatcherInfoBase;
 import org.apache.flex.compiler.internal.codegen.databinding.WatcherInfoBase.WatcherType;
 import org.apache.flex.compiler.internal.codegen.databinding.XMLWatcherInfo;
@@ -295,6 +296,16 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                 writeNewline(ASEmitterTokens.DOUBLE_QUOTE.getToken() + s + 
                         ASEmitterTokens.DOUBLE_QUOTE.getToken() + ASEmitterTokens.COMMA.getToken());
             
+            IExpressionNode destNode = bi.getExpressionNodeForDestination();
+            if (destNode != null)
+            {
+                StringBuilder sb = new StringBuilder();
+                sb.append(asEmitter.stringifyNode(destNode));
+                writeNewline(sb.toString());
+            }
+            else
+                writeNewline(ASEmitterTokens.NULL.getToken() + ASEmitterTokens.COMMA.getToken());
+            
             s = bi.getDestinationString();
             if (s.contains("."))
             {
@@ -309,13 +320,6 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                 }
                 writeNewline(ASEmitterTokens.SQUARE_CLOSE.getToken() + ASEmitterTokens.COMMA.getToken());
             }
-            else if (s == null || s.length() == 0)
-            {
-                IExpressionNode destNode = bi.getExpressionNodeForDestination();
-                StringBuilder sb = new StringBuilder();
-                sb.append(asEmitter.stringifyNode(destNode));
-                writeNewline(sb.toString());
-            }
             else
                 writeNewline(ASEmitterTokens.DOUBLE_QUOTE.getToken() + s +
                         ASEmitterTokens.DOUBLE_QUOTE.getToken() + ASEmitterTokens.COMMA.getToken());
@@ -333,6 +337,9 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
     private void encodeWatcher(WatcherInfoBase watcherInfoBase)
     {
+        IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker())
+        .getASEmitter();
+
         writeNewline(watcherInfoBase.getIndex() + ASEmitterTokens.COMMA.getToken());
         WatcherType type = watcherInfoBase.getType();
         if (type == WatcherType.FUNCTION)
@@ -343,6 +350,18 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
            
             writeNewline(ASEmitterTokens.DOUBLE_QUOTE.getToken() + functionWatcherInfo.getFunctionName()
+ 
                     ASEmitterTokens.DOUBLE_QUOTE.getToken());
+            IExpressionNode params[] = functionWatcherInfo.params;
+            StringBuilder sb = new StringBuilder();
+            sb.append("function() { return [");
+            boolean firstone = true;
+            for (IExpressionNode param : params)
+            {
+                if (firstone)
+                    firstone = false;
+                sb.append(ASEmitterTokens.COMMA.getToken());
+                sb.append(asEmitter.stringifyNode(param));   
+            }
+            sb.append("]; },");
             outputEventNames(functionWatcherInfo.getEventNames());
             outputBindings(functionWatcherInfo.getBindings());
         }
@@ -373,8 +392,12 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             outputBindings(propertyWatcherInfo.getBindings());
             if (propertyGetterFunction == null)
                 writeNewline("null" + ASEmitterTokens.COMMA.getToken()); // null is valid
-            // else 
-                // writeNewline(propertyGetterFunction);
+            if (type == WatcherType.STATIC_PROPERTY)
+            {
+                StaticPropertyWatcherInfo pwinfo = (StaticPropertyWatcherInfo)watcherInfoBase;
+                Name classMName = pwinfo.getContainingClass(getMXMLWalker().getProject());
+                writeNewline(nameToString(classMName));
+            }
         }
         else if (type == WatcherType.XML)
         {


Mime
View raw message