Repository: flex-falcon
Updated Branches:
  refs/heads/JsToAs [created] bb6425450


Now emit _as() / _is() instead of as() / is().

This is to match the changes made in the AS/JS project:
In order to migrate the JS code to AS3 code, we can't use "as" / "is" as 
function name because there are reserved words.


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

Branch: refs/heads/JsToAs
Commit: 5caf88d668335d2c1a23bd33c4f41664a8792526
Parents: 8884d0b
Author: Frédéric THOMAS <[email protected]>
Authored: Tue Sep 1 21:03:13 2015 +0100
Committer: Frédéric THOMAS <[email protected]>
Committed: Tue Sep 1 21:03:13 2015 +0100

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSExpressions.java        | 12 ++++++------
 .../internal/codegen/js/vf2js/TestVF2JSExpressions.java |  6 +++---
 .../compiler/internal/codegen/as/ASEmitterTokens.java   |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5caf88d6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index daee543..8729784 100644
--- 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -542,7 +542,7 @@ public class TestFlexJSExpressions extends 
TestGoogExpressions
 
         ((JSFlexJSEmitter)asEmitter).getModel().setCurrentClass(def);
         asBlockWalker.visitBinaryOperator(bnode);
-        assertOut("org.apache.flex.utils.Language.as(this.model, foo.bar.E, 
true).labelText = null");
+        assertOut("org.apache.flex.utils.Language._as(this.model, foo.bar.E, 
true).labelText = null");
     }
 
     @Test
@@ -706,7 +706,7 @@ public class TestFlexJSExpressions extends 
TestGoogExpressions
     {
         IClassNode node = (IClassNode) getNode("import 
spark.components.Button; public class B implements Button { public function B() 
{ Button(b).label = ''; } }", ClassNode.class, WRAP_LEVEL_PACKAGE);
         asBlockWalker.visitClass(node);
-        assertOut("/**\n * @constructor\n * @implements 
{spark.components.Button}\n */\nB = function() {\n  
org.apache.flex.utils.Language.as(b, spark.components.Button, true).label = 
'';\n};");
+        assertOut("/**\n * @constructor\n * @implements 
{spark.components.Button}\n */\nB = function() {\n  
org.apache.flex.utils.Language._as(b, spark.components.Button, true).label = 
'';\n};");
     }
 
     @Test
@@ -714,7 +714,7 @@ public class TestFlexJSExpressions extends 
TestGoogExpressions
     {
         IFunctionNode node = getMethod("function foo(){var foo:Object = 
FalconTest_A(bar).bar = '';}; public function get bar():Object { return this; 
};");
         asBlockWalker.visitFunction(node);
-        assertOut("FalconTest_A.prototype.foo = function() {\n  var /** @type 
{Object} */ foo = org.apache.flex.utils.Language.as(this.bar, FalconTest_A, 
true).bar = '';\n}");
+        assertOut("FalconTest_A.prototype.foo = function() {\n  var /** @type 
{Object} */ foo = org.apache.flex.utils.Language._as(this.bar, FalconTest_A, 
true).bar = '';\n}");
     }
 
     @Test
@@ -761,7 +761,7 @@ public class TestFlexJSExpressions extends 
TestGoogExpressions
     {
         IBinaryOperatorNode node = getBinaryNode("a as b");
         asBlockWalker.visitBinaryOperator(node);
-        assertOut("org.apache.flex.utils.Language.as(a, b)");
+        assertOut("org.apache.flex.utils.Language._as(a, b)");
     }
 
     @Test
@@ -771,7 +771,7 @@ public class TestFlexJSExpressions extends 
TestGoogExpressions
                 "public class B {public function b(o:Object):int { var a:B; a 
= o as B; }}",
                 IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
         asBlockWalker.visitFunction(node);
-        assertOut("/**\n * @export\n * @param {Object} o\n * @return 
{number}\n */\nfoo.bar.B.prototype.b = function(o) {\n  var /** @type 
{foo.bar.B} */ a;\n  a = org.apache.flex.utils.Language.as(o, foo.bar.B);\n}");
+        assertOut("/**\n * @export\n * @param {Object} o\n * @return 
{number}\n */\nfoo.bar.B.prototype.b = function(o) {\n  var /** @type 
{foo.bar.B} */ a;\n  a = org.apache.flex.utils.Language._as(o, foo.bar.B);\n}");
     }
 
     @Override
@@ -780,7 +780,7 @@ public class TestFlexJSExpressions extends 
TestGoogExpressions
     {
         IBinaryOperatorNode node = getBinaryNode("a is b");
         asBlockWalker.visitBinaryOperator(node);
-        assertOut("org.apache.flex.utils.Language.is(a, b)");
+        assertOut("org.apache.flex.utils.Language._is(a, b)");
     }
 
     protected IBackend createBackend()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5caf88d6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
index 3ba79e7..a05694c 100644
--- 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
+++ 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
@@ -94,7 +94,7 @@ public class TestVF2JSExpressions extends TestGoogExpressions
     {
         IBinaryOperatorNode node = getBinaryNode("a as b");
         asBlockWalker.visitBinaryOperator(node);
-        assertOut("org.apache.flex.utils.Language.as(a, b)");
+        assertOut("org.apache.flex.utils.Language._as(a, b)");
     }
 
     @Test
@@ -104,7 +104,7 @@ public class TestVF2JSExpressions extends 
TestGoogExpressions
                 "public class B {public function b(o:Object):int { var a:B; a 
= o as B; }}",
                 IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
         asBlockWalker.visitFunction(node);
-        assertOut("/**\n * @export\n * @param {Object} o\n * @return 
{number}\n */\nfoo.bar.B.prototype.b = function(o) {\n  var /** @type 
{foo.bar.B} */ a;\n  a = org.apache.flex.utils.Language.as(o, foo.bar.B);\n}");
+        assertOut("/**\n * @export\n * @param {Object} o\n * @return 
{number}\n */\nfoo.bar.B.prototype.b = function(o) {\n  var /** @type 
{foo.bar.B} */ a;\n  a = org.apache.flex.utils.Language._as(o, foo.bar.B);\n}");
     }
 
     @Override
@@ -113,7 +113,7 @@ public class TestVF2JSExpressions extends 
TestGoogExpressions
     {
         IBinaryOperatorNode node = getBinaryNode("a is b");
         asBlockWalker.visitBinaryOperator(node);
-        assertOut("org.apache.flex.utils.Language.is(a, b)");
+        assertOut("org.apache.flex.utils.Language._is(a, b)");
     }
 
     protected IBackend createBackend()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5caf88d6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
 
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
index 9296a78..e671aca 100644
--- 
a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
+++ 
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
@@ -133,8 +133,8 @@ public enum ASEmitterTokens implements IEmitterTokens
     LESS_THAN("<"),
     //    int TOKEN_OPERATOR_LESS_THAN_EQUALS = 99;
     INSTANCEOF("instanceof"),
-    IS("is"),
-    AS("as"),
+    IS("_is"),
+    AS("_as"),
     //    int TOKEN_OPERATOR_BITWISE_LEFT_SHIFT = 103;
     //    int TOKEN_OPERATOR_BITWISE_RIGHT_SHIFT = 104;
     //    int TOKEN_OPERATOR_BITWISE_UNSIGNED_RIGHT_SHIFT = 105;

Reply via email to