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] - Prevent 'self' on global functions in a method
Date Thu, 18 Apr 2013 19:29:11 GMT
Updated Branches:
  refs/heads/develop 51165d8a7 -> d013e6a85


Prevent 'self' on global functions in a method


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

Branch: refs/heads/develop
Commit: d013e6a85800f51dd2e92f8851a8310b0072f282
Parents: 51165d8
Author: Alex Harui <aharui@apache.org>
Authored: Thu Apr 18 12:28:41 2013 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Apr 18 12:28:41 2013 -0700

----------------------------------------------------------------------
 .../js/flexjs/TestFlexJSGlobalFunctions.java       |   11 +++++++++++
 .../codegen/js/flexjs/JSFlexJSEmitter.java         |    2 +-
 2 files changed, 12 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d013e6a8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
index 9a4210d..8d8bce5 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalFunctions.java
@@ -22,6 +22,7 @@ package org.apache.flex.compiler.internal.codegen.js.flexjs;
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogGlobalFunctions;
 import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
 import org.junit.Test;
 
@@ -49,6 +50,16 @@ public class TestFlexJSGlobalFunctions extends TestGoogGlobalFunctions
         assertOut("var /** @type {Vector.<string>} */ a = Array(['Hello', 'World'])");
     }
 
+    @Test
+    public void testGlobalFunctionInClass()
+    {
+        IBinaryOperatorNode node = (IBinaryOperatorNode) getNode(
+                "public class B {public function b():String { var s:String; s = encodeURIComponent('foo');
return s;}",
+                IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
+        asBlockWalker.visitBinaryOperator(node);
+        assertOut("s = encodeURIComponent('foo')");
+    }
+
     @Override
     protected IBackend createBackend()
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d013e6a8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index ff9e307..c39d8e4 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -278,7 +278,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                         if (def instanceof FunctionDefinition)
                         {
                             if (((FunctionDefinition) def)
-                                    .getFunctionClassification() != IFunctionDefinition.FunctionClassification.LOCAL)
+                                    .getFunctionClassification() == IFunctionDefinition.FunctionClassification.CLASS_MEMBER)
                                 writeSelf = true;
                         }
                         else


Mime
View raw message