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] - fix emitting of state event overrides
Date Fri, 09 Jan 2015 00:43:59 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 2591c553c -> 5f59503a7


fix emitting of state event overrides


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

Branch: refs/heads/develop
Commit: 5f59503a74389bf8f9917b11c22ee08461bdb9ae
Parents: 2591c55
Author: Alex Harui <aharui@apache.org>
Authored: Thu Jan 8 16:42:43 2015 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Jan 8 16:42:43 2015 -0800

----------------------------------------------------------------------
 .../codegen/mxml/flexjs/MXMLEventSpecifier.java     |  8 +++++++-
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java      | 16 +++++++++-------
 2 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5f59503a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLEventSpecifier.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLEventSpecifier.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLEventSpecifier.java
index b3d8c04..d419df6 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLEventSpecifier.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLEventSpecifier.java
@@ -47,7 +47,7 @@ public class MXMLEventSpecifier extends MXMLNodeSpecifier
     //
     //--------------------------------------------------------------------------
 
-    List<String> nameMap = Arrays.asList(
+    static List<String> nameMap = Arrays.asList(
     		"rollOver",
     		"rollOut",
     		"mouseDown",
@@ -90,4 +90,10 @@ public class MXMLEventSpecifier extends MXMLNodeSpecifier
         return sb.toString();
     }
 
+    public static String getJSEventName(String name)
+    {
+    	if (nameMap.contains(name))
+    		return name.toLowerCase();
+    	return name;
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5f59503a/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 f052173..cdee4d6 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
@@ -972,11 +972,10 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         }
         eventSpecifier.value = sb.toString();
 
-        if (currentDescriptor != null)
-            currentDescriptor.eventSpecifiers.add(eventSpecifier);
-        else  // in theory, if no currentdescriptor must be top tag event
-            propertiesTree.eventSpecifiers.add(eventSpecifier);
-
+	    if (currentDescriptor != null)
+	        currentDescriptor.eventSpecifiers.add(eventSpecifier);
+	    else if (!inStatesOverride) // in theory, if no currentdescriptor must be top tag event
+	        propertiesTree.eventSpecifiers.add(eventSpecifier);
         events.add(eventSpecifier);
     }
 
@@ -1218,7 +1217,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                     ((IMXMLInstanceNode)parentNode).getEffectiveID() :
                     "";
         
-        String name = eventNode.getName();
+        String name = MXMLEventSpecifier.getJSEventName(eventNode.getName());
         
         String eventHandler = eventHandlerNameMap.get(eventNode);
         if (eventHandler == null)
@@ -1254,7 +1253,10 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         handler.isProperty = true;
         handler.name = "handlerFunction";
         handler.parent = setEvent;
-        handler.value = ASEmitterTokens.THIS.getToken() + ASEmitterTokens.MEMBER_ACCESS.getToken()
+ eventHandler;
+        handler.value = JSGoogEmitterTokens.GOOG_BIND.getToken() + ASEmitterTokens.PAREN_OPEN.getToken()
+ 
+        		ASEmitterTokens.THIS.getToken() + ASEmitterTokens.MEMBER_ACCESS.getToken() + eventHandler
+
+        		ASEmitterTokens.COMMA.getToken() + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.THIS.getToken()
+
+        		ASEmitterTokens.PAREN_CLOSE.getToken();
         setEvent.propertySpecifiers.add(handler);
         
         inStatesOverride = false;


Mime
View raw message