flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject [21/51] [partial] git commit: [flex-falcon] [refs/heads/feature/maven-migration-test] - - Check-In of the migrated project to make error analysis easier
Date Wed, 13 Apr 2016 18:56:13 GMT
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3dce49f/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogStatements.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogStatements.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogStatements.java
new file mode 100644
index 0000000..cf550da
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogStatements.java
@@ -0,0 +1,310 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.goog;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.as.TestStatements;
+import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
+import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.tree.as.IForLoopNode;
+import org.apache.flex.compiler.tree.as.ISwitchNode;
+import org.apache.flex.compiler.tree.as.ITryNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.junit.Test;
+
+/**
+ * @author Michael Schmalle
+ * @author Erik de Bruin
+ */
+public class TestGoogStatements extends TestStatements
+{
+    //----------------------------------
+    // var declaration
+    //----------------------------------
+
+    @Override
+    @Test
+    public void testVarDeclaration()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {*} */ a");
+    }
+
+    @Override
+    @Test
+    public void testVarDeclaration_withType()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a:int;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {number} */ a");
+    }
+
+    @Override
+    @Test
+    public void testVarDeclaration_withTypeAssignedValue()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a:int = 42;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {number} */ a = 42");
+    }
+
+    @Override
+    @Test
+    public void testVarDeclaration_withTypeAssignedValueComplex()
+    {
+        IVariableNode node = (IVariableNode) getNode(
+                "class A { public function b():void { var a:Foo = new Foo(42, 'goo');}} class Foo {}", IVariableNode.class, WRAP_LEVEL_PACKAGE);
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {Foo} */ a = new Foo(42, 'goo')");
+    }
+
+    @Override
+    @Test
+    public void testVarDeclaration_withList()
+    {
+        IVariableNode node = (IVariableNode) getNode(
+                "var a:int = 4, b:int = 11, c:int = 42;", IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {number} */ a = 4, /** @type {number} */ b = 11, /** @type {number} */ c = 42");
+    }
+
+    //----------------------------------
+    // const declaration
+    //----------------------------------
+
+    @Override
+    @Test
+    public void testConstDeclaration()
+    {
+        IVariableNode node = (IVariableNode) getNode("const a = 42;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("\n/**\n * @const\n * @type {*}\n */\na = 42");
+    }
+
+    @Override
+    @Test
+    public void testConstDeclaration_withType()
+    {
+        IVariableNode node = (IVariableNode) getNode("const a:int = 42;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("\n/**\n * @const\n * @type {number}\n */\na = 42");
+    }
+
+    @Override
+    @Test
+    public void testConstDeclaration_withList()
+    {
+        IVariableNode node = (IVariableNode) getNode(
+                "const a:int = 4, b:int = 11, c:int = 42;", IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("\n/**\n * @const\n * @type {number}\n */\na = 4, \n/**\n * @const\n * @type {number}\n */\nb = 11, \n/**\n * @const\n * @type {number}\n */\nc = 42");
+    }
+
+    //----------------------------------
+    // for () { }
+    //----------------------------------
+
+    @Override
+    @Test
+    public void testVisitFor_1a()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int = 0; i < len; i++) { break; }",
+                IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("for (var /** @type {number} */ i = 0; i < len; i++) {\n\tbreak;\n}");
+    }
+
+    @Override
+    @Test
+    public void testVisitFor_1b()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int = 0; i < len; i++) break;", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("for (var /** @type {number} */ i = 0; i < len; i++)\n\tbreak;");
+    }
+
+    @Override
+    @Test
+    public void testVisitForIn_1()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int in obj) { break; }", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("for (var /** @type {number} */ i in obj) {\n\tbreak;\n}");
+    }
+
+    @Override
+    @Test
+    public void testVisitForIn_1a()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int in obj)  break; ", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("for (var /** @type {number} */ i in obj)\n\tbreak;");
+    }
+
+    @Override
+    @Test
+    public void testVisitForEach_1()
+    {
+        // TODO (erikdebruin) we need to insert a "goog.require('goog.array')"
+        //                    into the header
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for each(var i:int in obj) { break; }", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("goog.array.forEach(obj, function (i) {\n\tbreak;\n})");
+    }
+
+    @Override
+    @Test
+    public void testVisitForEach_1a()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for each(var i:int in obj)  break; ", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("goog.array.forEach(obj, function (i) {\n\tbreak;\n})");
+    }
+
+    //----------------------------------
+    // try {} catch () {} finally {}
+    //----------------------------------
+
+    @Override
+    @Test
+    public void testVisitTry_Catch()
+    {
+        ITryNode node = (ITryNode) getNode("try { a; } catch (e:Error) { b; }",
+                ITryNode.class);
+        asBlockWalker.visitTry(node);
+        assertOut("try {\n\ta;\n} catch (e) {\n\tb;\n}");
+    }
+
+    @Override
+    @Test
+    public void testVisitTry_Catch_Finally()
+    {
+        ITryNode node = (ITryNode) getNode(
+                "try { a; } catch (e:Error) { b; } finally { c; }",
+                ITryNode.class);
+        asBlockWalker.visitTry(node);
+        assertOut("try {\n\ta;\n} catch (e) {\n\tb;\n} finally {\n\tc;\n}");
+    }
+
+    @Override
+    @Test
+    public void testVisitTry_Catch_Catch_Finally()
+    {
+        // TODO (erikdebruin) handle multiple 'catch' statements (FW in Wiki)
+        ITryNode node = (ITryNode) getNode(
+                "try { a; } catch (e:Error) { b; } catch (f:Error) { c; } finally { d; }",
+                ITryNode.class);
+        asBlockWalker.visitTry(node);
+        assertOut("try {\n\ta;\n} catch (e) {\n\tb;\n} catch (f) {\n\tc;\n} finally {\n\td;\n}");
+    }
+
+    @Override
+    @Test
+    public void testVisitTry_CatchEmpty_FinallyEmpty_()
+    {
+        ITryNode node = (ITryNode) getNode(
+                "try { a; } catch (e:Error) {  } finally {  }", ITryNode.class);
+        asBlockWalker.visitTry(node);
+        assertOut("try {\n\ta;\n} catch (e) {\n} finally {\n}");
+    }
+
+    //----------------------------------
+    // switch {}
+    //----------------------------------
+
+    @Test
+    public void testVisitSwitch_3()
+    {
+        ISwitchNode node = (ISwitchNode) getNode(
+                "switch(i){case 1: { var x:int = 42; break; }; case 2: { var y:int = 66; break; }}", ISwitchNode.class);
+        asBlockWalker.visitSwitch(node);
+        assertOut("switch (i) {\n\tcase 1:\n\t\tvar /** @type {number} */ x = 42;\n\t\tbreak;\n\tcase 2:\n\t\tvar /** @type {number} */ y = 66;\n\t\tbreak;\n}");
+    }
+
+    //----------------------------------
+    // label : for () {}
+    //----------------------------------
+
+    @Override
+    @Test
+    public void testVisitLabel_1()
+    {
+        LabeledStatementNode node = (LabeledStatementNode) getNode(
+                "foo: for each(var i:int in obj) { break foo; }",
+                LabeledStatementNode.class);
+        asBlockWalker.visitLabeledStatement(node);
+        assertOut("foo : goog.array.forEach(obj, function (i) {\n\tbreak foo;\n})");
+    }
+
+    @Override
+    @Test
+    public void testVisitLabel_1a()
+    {
+        LabeledStatementNode node = (LabeledStatementNode) getNode(
+                "foo: for each(var i:int in obj) break foo;",
+                LabeledStatementNode.class);
+        asBlockWalker.visitLabeledStatement(node);
+        assertOut("foo : goog.array.forEach(obj, function (i) {\n\tbreak foo;\n})");
+    }
+
+    //----------------------------------
+    // all together now!
+    //----------------------------------
+
+    @Override
+    @Test
+    public void testVisit()
+    {
+        IFileNode node = (IFileNode) getNode(
+                "try { a; } catch (e:Error) { if (a) { if (b) { if (c) b; else if (f) a; else e; }} } finally {  }"
+                        + "if (d) for (var i:int = 0; i < len; i++) break;"
+                        + "if (a) { with (ab) { c(); } "
+                        + "do {a++;do a++; while(a > b);} while(c > d); }"
+                        + "if (b) { try { a; throw new Error('foo'); } catch (e:Error) { "
+                        + " switch(i){case 1: break; default: return;}"
+                        + " } finally { "
+                        + "  d;  var a:Object = function(foo:int, bar:String = 'goo'):int{return -1;};"
+                        + "  eee.dd; eee.dd; eee.dd; eee.dd;} }"
+                        + "foo: for each(var i:int in obj) break foo;",
+                IFileNode.class);
+        asBlockWalker.visitFile(node);
+        assertOut("goog.provide('FalconTest_A');\n\n/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\nFalconTest_A.prototype.falconTest_a = function() {\n\tvar self = this;\n\ttry {\n\t\ta;\n\t} catch (e) {\n\t\tif (a) {\n\t\t\tif (b) {\n\t\t\t\tif (c)\n\t\t\t\t\tb;\n\t\t\t\telse if (f)\n\t\t\t\t\ta;\n\t\t\t\telse\n\t\t\t\t\te;\n\t\t\t}\n\t\t}\n\t} finally {\n\t}\n\tif (d)\n\t\tfor (var /** @type {number} */ i = 0; i < len; i++)\n\t\t\tbreak;\n\tif (a) {\n\t\twith (ab) {\n\t\t\tc();\n\t\t}\n\t\tdo {\n\t\t\ta++;\n\t\t\tdo\n\t\t\t\ta++;\n\t\t\twhile (a > b);\n\t\t} while (c > d);\n\t}\n\tif (b) {\n\t\ttry {\n\t\t\ta;\n\t\t\tthrow new Error('foo');\n\t\t} catch (e) {\n\t\t\tswitch (i) {\n\t\t\t\tcase 1:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn;\n\t\t\t}\n\t\t} finally {\n\t\t\td;\n\t\t\tvar /** @type {Object} */ a = function(foo, bar) {\n\t\t\t\tbar = typeof bar !== 'undefined' ? bar : 'goo';\n\t\t\t\treturn -1;\n\t\t\t};\n\t\t\teee.dd;\n\t\t\teee.dd;\n\t\t\tee
 e.dd;\n\t\t\teee.dd;\n\t\t}\n\t}\n\tfoo : goog.array.forEach(obj, function (i) {\n\t\tbreak foo;\n\t});\n};");
+    }
+
+    @Override
+    protected IBackend createBackend()
+    {
+        return new GoogBackend();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3dce49f/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
new file mode 100644
index 0000000..57ab17b
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
@@ -0,0 +1,716 @@
+package org.apache.flex.compiler.internal.codegen.js.sourcemaps;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.test.SourceMapTestBase;
+import org.apache.flex.compiler.internal.tree.as.ArrayLiteralNode;
+import org.apache.flex.compiler.internal.tree.as.ObjectLiteralNode;
+import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
+import org.apache.flex.compiler.tree.as.IFunctionCallNode;
+import org.apache.flex.compiler.tree.as.IIterationFlowNode;
+import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
+import org.apache.flex.compiler.tree.as.IReturnNode;
+import org.apache.flex.compiler.tree.as.ITernaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
+
+import org.junit.Test;
+
+public class TestSourceMapExpressions extends SourceMapTestBase
+{
+    //----------------------------------
+    // Primary expression keywords
+    //----------------------------------
+
+    //----------------------------------
+    // Arithmetic
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_Plus()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a + b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_Minus()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a - b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_Divide()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a / b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_Modulo()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a % b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_Multiply()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a * b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_PostIncrement()
+    {
+        IUnaryOperatorNode node = getUnaryNode("a++");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 3);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_PreIncrement()
+    {
+        IUnaryOperatorNode node = getUnaryNode("++a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 2);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_PostDecrement()
+    {
+        IUnaryOperatorNode node = getUnaryNode("a--");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 3);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_PreDecrement()
+    {
+        IUnaryOperatorNode node = getUnaryNode("--a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 2);
+    }
+
+    //----------------------------------
+    // Arithmetic compound assignment
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_PlusAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a += b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_MinusAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a -= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_DivideAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a /= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_ModuloAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a %= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_MultiplyAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a *= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    //----------------------------------
+    // Assignment
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_Assignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a = b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    //----------------------------------
+    // Bitwise
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseAnd()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a & b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseLeftShift()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a << b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_BitwiseNot()
+    {
+        IUnaryOperatorNode node = getUnaryNode("~a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 1);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseOr()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a | b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseRightShift()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a >> b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseUnsignedRightShift()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a >>> b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 6);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseXOR()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a ^ b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    //----------------------------------
+    // Bitwise compound assignment
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseAndAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a &= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseLeftShiftAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a <<= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 6);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseOrAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a |= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseRightShiftAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a >>= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 6);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseUnsignedRightShiftAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a >>>= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 7);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseXORAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a ^= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    //----------------------------------
+    // Comparison
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_Equal()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a == b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_GreaterThan()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a > b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_GreaterThanEqual()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a >= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_NotEqual()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a != b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_LessThan()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a < b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_LessThanEqual()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a <= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_StrictEqual()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a === b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 6);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_StrictNotEqual()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a !== b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 6);
+    }
+
+    //----------------------------------
+    // Logical
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_LogicalAnd()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a && b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_LogicalAndAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a &&= b");
+        asBlockWalker.visitBinaryOperator(node);
+        //a = a && b
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+        assertMapping(node, 0, 1, 0, 5, 0, 9);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_LogicalNot()
+    {
+        IUnaryOperatorNode node = getUnaryNode("!a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 1);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_LogicalOr()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a || b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_LogicalOrAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a ||= b");
+        asBlockWalker.visitBinaryOperator(node);
+        //a = a || b
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+        assertMapping(node, 0, 1, 0, 5, 0, 9);
+    }
+
+    //----------------------------------
+    // Other
+    //----------------------------------
+
+    @Test
+    public void testVisitDynamicAccessNode_1()
+    {
+        IDynamicAccessNode node = getDynamicAccessNode("a[b]");
+        asBlockWalker.visitDynamicAccess(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 3, 0, 3, 0, 4);
+    }
+
+    @Test
+    public void testVisitDynamicAccessNode_2()
+    {
+        IDynamicAccessNode node = getDynamicAccessNode("a[b[c][d]]");
+        asBlockWalker.visitDynamicAccess(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 3, 0, 3, 0, 4);
+        assertMapping(node, 0, 5, 0, 5, 0, 6);
+        assertMapping(node, 0, 6, 0, 6, 0, 7);
+        assertMapping(node, 0, 8, 0, 8, 0, 9);
+        assertMapping(node, 0, 9, 0, 9, 0, 10);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_Comma()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a, b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 3);
+    }
+
+    @Test
+    public void testVisitTernaryOperatorNode()
+    {
+        ITernaryOperatorNode node = (ITernaryOperatorNode) getExpressionNode(
+                "a ? b : c", ITernaryOperatorNode.class);
+        asBlockWalker.visitTernaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+        assertMapping(node, 0, 5, 0, 5, 0, 8);
+    }
+
+    @Test
+    public void testVisitUnaryOperator_Delete()
+    {
+        IUnaryOperatorNode node = getUnaryNode("delete a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 7);
+    }
+
+    @Test
+    public void testVisitMemberAccess_1()
+    {
+        IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getExpressionNode(
+                "a.b", IMemberAccessExpressionNode.class);
+        asBlockWalker.visitMemberAccessExpression(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+    }
+
+    @Test
+    public void testVisitMemberAccess_2()
+    {
+        IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getExpressionNode(
+                "a.b.c.d", IMemberAccessExpressionNode.class);
+        asBlockWalker.visitMemberAccessExpression(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 3, 0, 3, 0, 4);
+        assertMapping(node, 0, 5, 0, 5, 0, 6);
+    }
+
+    @Test
+    public void testVisitBinaryOperator_In()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a in b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperator_Instancof()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a instanceof b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 13);
+    }
+
+    @Test
+    public void testVisitBinaryOperator_New()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getExpressionNode(
+                "new Object()", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 4);
+    }
+
+    @Test
+    public void testVisitObjectLiteral_1()
+    {
+        ObjectLiteralNode node = (ObjectLiteralNode) getExpressionNode(
+                "a = {a:1}", ObjectLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 1); // {
+        assertMapping(node, 0, 1, 0, 1, 0, 2); // a
+        assertMapping(node, 0, 2, 0, 2, 0, 3); // :
+        assertMapping(node, 0, 4, 0, 4, 0, 5); // }
+    }
+
+    @Test
+    public void testVisitObjectLiteral_2()
+    {
+        ObjectLiteralNode node = (ObjectLiteralNode) getExpressionNode(
+                "a = {a:1,b:{c:2,d:{e:4}}}", ObjectLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //{a:1, b:{c:2, d:{e:4}}}
+        assertMapping(node, 0, 0, 0, 0, 0, 1);    // {
+        assertMapping(node, 0, 1, 0, 1, 0, 2);    // a
+        assertMapping(node, 0, 2, 0, 2, 0, 3);    // :
+        assertMapping(node, 0, 4, 0, 4, 0, 6);    // ,
+        assertMapping(node, 0, 5, 0, 6, 0, 7);    // b
+        assertMapping(node, 0, 6, 0, 7, 0, 8);    // :
+        assertMapping(node, 0, 7, 0, 8, 0, 9);    // {
+        assertMapping(node, 0, 8, 0, 9, 0, 10);   // c
+        assertMapping(node, 0, 9, 0, 10, 0, 11);  // :
+        assertMapping(node, 0, 11, 0, 12, 0, 14); // ,
+        assertMapping(node, 0, 12, 0, 14, 0, 15); // d
+        assertMapping(node, 0, 13, 0, 15, 0, 16); // :
+        assertMapping(node, 0, 14, 0, 16, 0, 17); // {
+        assertMapping(node, 0, 15, 0, 17, 0, 18); // e
+        assertMapping(node, 0, 16, 0, 18, 0, 19); // :
+        assertMapping(node, 0, 18, 0, 20, 0, 21); // }
+        assertMapping(node, 0, 19, 0, 21, 0, 22); // }
+        assertMapping(node, 0, 20, 0, 22, 0, 23); // }
+        
+    }
+
+    @Test
+    public void testVisitObjectLiteral_3()
+    {
+        ObjectLiteralNode node = (ObjectLiteralNode) getExpressionNode(
+                "a = { a: 12,  bb: 2   \t}", ObjectLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //{a:12, bb:2}
+        assertMapping(node, 0, 0, 0, 0, 0, 1);    // {
+        assertMapping(node, 0, 2, 0, 1, 0, 2);    // a
+        assertMapping(node, 0, 3, 0, 2, 0, 3);    // :
+        assertMapping(node, 0, 7, 0, 5, 0, 7);    // ,
+        assertMapping(node, 0, 10, 0, 7, 0, 9);   // bb
+        assertMapping(node, 0, 12, 0, 9, 0, 10);  // :
+        assertMapping(node, 0, 19, 0, 11, 0, 12); // }
+    }
+
+    @Test
+    public void testVisitArrayLiteral_1()
+    {
+        ArrayLiteralNode node = (ArrayLiteralNode) getExpressionNode(
+                "a = [0,1,2]", ArrayLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //[0, 1, 2]
+        assertMapping(node, 0, 0, 0, 0, 0, 1); // [
+        assertMapping(node, 0, 2, 0, 2, 0, 4); // ,
+        assertMapping(node, 0, 4, 0, 5, 0, 7); // ,
+        assertMapping(node, 0, 6, 0, 8, 0, 9); // ]
+    }
+
+    @Test
+    public void testVisitArrayLiteral_2()
+    {
+        ArrayLiteralNode node = (ArrayLiteralNode) getExpressionNode(
+                "a = [0,[0,1,[0,1]],2,[1,2]]", ArrayLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //[0, [0, 1, [0, 1]], 2, [1, 2]]
+        assertMapping(node, 0, 0, 0, 0, 0, 1);    // [
+        assertMapping(node, 0, 2, 0, 2, 0, 4);    // ,
+        assertMapping(node, 0, 3, 0, 4, 0, 5);    // [
+        assertMapping(node, 0, 5, 0, 6, 0, 8);    // ,
+        assertMapping(node, 0, 7, 0, 9, 0, 11);   // ,
+        assertMapping(node, 0, 8, 0, 11, 0, 12);  // [
+        assertMapping(node, 0, 10, 0, 13, 0, 15); // ,
+        assertMapping(node, 0, 12, 0, 16, 0, 17); // ]
+        assertMapping(node, 0, 13, 0, 17, 0, 18); // ]
+        
+        assertMapping(node, 0, 14, 0, 18, 0, 20); // ,
+        assertMapping(node, 0, 16, 0, 21, 0, 23); // ,
+        assertMapping(node, 0, 17, 0, 23, 0, 24); // [
+        assertMapping(node, 0, 19, 0, 25, 0, 27); // ,
+        assertMapping(node, 0, 21, 0, 28, 0, 29); // ]
+        assertMapping(node, 0, 22, 0, 29, 0, 30); // ]
+    }
+
+    @Test
+    public void testVisitArrayLiteral_3()
+    {
+        ArrayLiteralNode node = (ArrayLiteralNode) getExpressionNode(
+                "a = [ 0,  123, 45   \t]", ArrayLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //[0, 123, 45]
+        assertMapping(node, 0, 0, 0, 0, 0, 1);    // [
+        assertMapping(node, 0, 3, 0, 2, 0, 4);    // ,
+        assertMapping(node, 0, 9, 0, 7, 0, 9);    // ,
+        assertMapping(node, 0, 17, 0, 11, 0, 12); // ]
+    }
+
+    @Test
+    public void testVisitArrayLiteral_4()
+    {
+        ArrayLiteralNode node = (ArrayLiteralNode) getExpressionNode(
+                "a = [0,\n123, 45]", ArrayLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //[0, 123, 45]
+        assertMapping(node, 0, 0, 0, 0, 0, 1);    // [
+        assertMapping(node, 0, 1, 0, 1, 0, 2);    // 0
+        assertMapping(node, 0, 2, 0, 2, 0, 4);    // ,
+        assertMapping(node, 1, 0, 0, 4, 0, 7);    // 123
+        assertMapping(node, 1, 3, 0, 7, 0, 9);    // ,
+        assertMapping(node, 1, 5, 0, 9, 0, 11);    // 45
+        //TODO: figure out how to place the ] 
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_Typeof()
+    {
+        IUnaryOperatorNode node = getUnaryNode("typeof(a)");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 7);
+        assertMapping(node, 0, 0, 0, 8, 0, 9);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_Typeof_NoParens()
+    {
+        // TODO (mschmalle) the notation without parenthesis is also valid in AS/JS
+        IUnaryOperatorNode node = getUnaryNode("typeof a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 7);
+        assertMapping(node, 0, 0, 0, 8, 0, 9);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_Void()
+    {
+        IUnaryOperatorNode node = getUnaryNode("void a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 5);
+    }
+
+    @Test
+    public void testVisitIterationFlowNode_BreakWithoutLabel()
+    {
+        IIterationFlowNode node = (IIterationFlowNode) getNode("break",
+                IIterationFlowNode.class);
+        asBlockWalker.visitIterationFlow(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 5);
+    }
+
+    @Test
+    public void testVisitIterationFlowNode_BreakWithLabel()
+    {
+        IIterationFlowNode node = (IIterationFlowNode) getNode("break label",
+                IIterationFlowNode.class);
+        asBlockWalker.visitIterationFlow(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 6);
+    }
+
+    @Test
+    public void testVisitIterationFlowNode_ContinueWithoutLabel()
+    {
+        IIterationFlowNode node = (IIterationFlowNode) getNode("continue",
+                IIterationFlowNode.class);
+        asBlockWalker.visitIterationFlow(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 8);
+    }
+
+    @Test
+    public void testVisitIterationFlowNode_ContinueWithLabel()
+    {
+        IIterationFlowNode node = (IIterationFlowNode) getNode("continue label",
+                IIterationFlowNode.class);
+        asBlockWalker.visitIterationFlow(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 9);
+    }
+
+    @Test
+    public void testVisitReturnWithoutValue()
+    {
+        IReturnNode node = (IReturnNode) getNode("return", IReturnNode.class);
+        asBlockWalker.visitReturn(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 6);
+    }
+
+    @Test
+    public void testVisitReturnWithValue()
+    {
+        IReturnNode node = (IReturnNode) getNode("return 0", IReturnNode.class);
+        asBlockWalker.visitReturn(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 7);
+    }
+
+    @Test
+    public void testVisitFunctionCall_1()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getNode("a()", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 2, 0, 2, 0, 3);
+    }
+
+    @Test
+    public void testVisitFunctionCall_2()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getNode("a(b)", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 3, 0, 3, 0, 4);
+    }
+
+    @Test
+    public void testVisitFunctionCall_3()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getNode("a(b, c)", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 3, 0, 3, 0, 5);
+        assertMapping(node, 0, 6, 0, 6, 0, 7);
+    }
+
+    protected IBackend createBackend()
+    {
+        return new FlexJSBackend();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3dce49f/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
new file mode 100644
index 0000000..3c25d07
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
@@ -0,0 +1,171 @@
+package org.apache.flex.compiler.internal.codegen.js.sourcemaps;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.test.SourceMapTestBase;
+import org.apache.flex.compiler.tree.as.IForLoopNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+
+import org.junit.Test;
+
+public class TestSourceMapStatements extends SourceMapTestBase
+{
+    //----------------------------------
+    // var declaration
+    //----------------------------------
+
+    @Test
+    public void testVarDeclaration()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        //var /** @type {*} */ a
+        assertMapping(node, 0, 0, 0, 0, 0, 4);   // var
+        assertMapping(node, 0, 4, 0, 21, 0, 22); // a
+        assertMapping(node, 0, 5, 0, 4, 0, 21);  // (type)
+    }
+
+    @Test
+    public void testVarDeclaration_withType()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a:int;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        //var /** @type {number} */ a
+        assertMapping(node, 0, 0, 0, 0, 0, 4);   // var
+        assertMapping(node, 0, 4, 0, 26, 0, 27); // a
+        assertMapping(node, 0, 5, 0, 4, 0, 26);  // :int
+    }
+
+    @Test
+    public void testVarDeclaration_withTypeAssignedValue()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a:int = 42;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        //var /** @type {number} */ a = 42
+        assertMapping(node, 0, 0, 0, 0, 0, 4);    // var
+        assertMapping(node, 0, 4, 0, 26, 0, 27);  // a
+        assertMapping(node, 0, 5, 0, 4, 0, 26);   // :int
+        assertMapping(node, 0, 9, 0, 27, 0, 30);  // =
+        assertMapping(node, 0, 12, 0, 30, 0, 32); // 42
+    }
+
+    @Test
+    public void testVarDeclaration_withTypeAssignedValueComplex()
+    {
+        IVariableNode node = (IVariableNode) getNode(
+                "class A { public function b():void { var a:Foo = new Foo(42, 'goo');}} class Foo {}", IVariableNode.class, WRAP_LEVEL_PACKAGE);
+        asBlockWalker.visitVariable(node);
+        //var /** @type {Foo} */ a = new Foo(42, 'goo')
+        assertMapping(node, 0, 0, 0, 0, 0, 4);    // var
+        assertMapping(node, 0, 4, 0, 23, 0, 24);  // a
+        assertMapping(node, 0, 5, 0, 4, 0, 23);   // :Foo
+        assertMapping(node, 0, 9, 0, 24, 0, 27);  // =
+        assertMapping(node, 0, 12, 0, 27, 0, 31);  // new
+        assertMapping(node, 0, 16, 0, 31, 0, 34);  // Foo
+        assertMapping(node, 0, 19, 0, 34, 0, 35);  // (
+        assertMapping(node, 0, 20, 0, 35, 0, 37);  // 42
+        assertMapping(node, 0, 22, 0, 37, 0, 39);  // ,
+        assertMapping(node, 0, 24, 0, 39, 0, 44);  // 'goo'
+        assertMapping(node, 0, 29, 0, 44, 0, 45);  // )
+    }
+
+    @Test
+    public void testVarDeclaration_withList()
+    {
+        IVariableNode node = (IVariableNode) getNode(
+                "var a:int = 4, b:int = 11, c:int = 42;", IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        //var /** @type {number} */ a = 4, /** @type {number} */ b = 11, /** @type {number} */ c = 42
+        assertMapping(node, 0, 0, 0, 0, 0, 4);    // var
+        assertMapping(node, 0, 4, 0, 26, 0, 27);  // a
+        assertMapping(node, 0, 5, 0, 4, 0, 26);   // :int
+        assertMapping(node, 0, 9, 0, 27, 0, 30);  // =
+        assertMapping(node, 0, 12, 0, 30, 0, 31); // 4
+        assertMapping(node, 0, 13, 0, 31, 0, 33); // ,
+        assertMapping(node, 0, 15, 0, 55, 0, 56); // b
+        assertMapping(node, 0, 16, 0, 33, 0, 55); // :int
+        assertMapping(node, 0, 20, 0, 56, 0, 59); // =
+        assertMapping(node, 0, 23, 0, 59, 0, 61); // 11
+        assertMapping(node, 0, 25, 0, 61, 0, 63); // ,
+        assertMapping(node, 0, 27, 0, 85, 0, 86); // c
+        assertMapping(node, 0, 28, 0, 63, 0, 85); // :int
+        assertMapping(node, 0, 32, 0, 86, 0, 89); // =
+        assertMapping(node, 0, 35, 0, 89, 0, 91); // 42
+    }
+
+    //----------------------------------
+    // for () { }
+    //----------------------------------
+
+    @Test
+    public void testVisitFor_1a()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int = 0; i < len; i++) { break; }",
+                IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        //for (var /** @type {number} */ i = 0; i < len; i++) {\n  break;\n}
+        assertMapping(node, 0, 0, 0, 0, 0, 5);    // for (
+        assertMapping(node, 0, 18, 0, 36, 0, 38); // ;
+        assertMapping(node, 0, 27, 0, 45, 0, 47); // ;
+        assertMapping(node, 0, 32, 0, 50, 0, 52); // )
+    }
+
+    @Test
+    public void testVisitFor_1b()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int = 0; i < len; i++) break;", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        //for (var /** @type {number} */ i = 0; i < len; i++)\n  break;
+        assertMapping(node, 0, 0, 0, 0, 0, 5);    // for (
+        assertMapping(node, 0, 18, 0, 36, 0, 38); // ;
+        assertMapping(node, 0, 27, 0, 45, 0, 47); // ;
+        assertMapping(node, 0, 32, 0, 50, 0, 51); // )
+    }
+
+    @Test
+    public void testVisitFor_2()
+    {
+        IForLoopNode node = (IForLoopNode) getNode("for (;;) { break; }",
+                IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        //for (;;) {\n  break;\n}
+        assertMapping(node, 0, 0, 0, 0, 0, 5); // for (
+        assertMapping(node, 0, 5, 0, 5, 0, 6); // ;
+        assertMapping(node, 0, 6, 0, 6, 0, 7); // ;
+        assertMapping(node, 0, 7, 0, 7, 0, 9); // )
+    }
+
+    @Test
+    public void testVisitForIn_1()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int in obj) { break; }", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        //for (var /** @type {number} */ i in obj) {\n  break;\n}
+        assertMapping(node, 0, 0, 0, 0, 0, 5);    // for (
+        assertMapping(node, 0, 14, 0, 32, 0, 36); // in
+        assertMapping(node, 0, 21, 0, 39, 0, 41); // )
+    }
+
+    @Test
+    public void testVisitForIn_1a()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int in obj)  break; ", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        //for (var /** @type {number} */ i in obj)\n  break;
+        assertMapping(node, 0, 0, 0, 0, 0, 5);    // for (
+        assertMapping(node, 0, 14, 0, 32, 0, 36); // in
+        assertMapping(node, 0, 21, 0, 39, 0, 40); // )
+    }
+
+    protected IBackend createBackend()
+    {
+        return new FlexJSBackend();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3dce49f/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
new file mode 100644
index 0000000..588a892
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
@@ -0,0 +1,402 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.vf2js;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogClass;
+import org.apache.flex.compiler.internal.driver.js.vf2js.VF2JSBackend;
+import org.apache.flex.compiler.tree.as.IClassNode;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.utils.FilenameNormalization;
+import org.junit.Test;
+
+/**
+ * @author Erik de Bruin
+ */
+public class TestVF2JSClass extends TestGoogClass
+{
+
+    @Override
+    @Test
+    public void testSimple()
+    {
+        IClassNode node = getClassNode("public class A{}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};");
+    }
+
+    @Override
+    @Test
+    public void testSimpleInternal()
+    {
+        // (erikdebruin) the AS compiler will enforce 'internal' namespace, 
+        //               in JS we ignore it
+        IClassNode node = getClassNode("internal class A{}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};");
+    }
+
+    @Override
+    @Test
+    public void testSimpleFinal()
+    {
+        // (erikdebruin) the AS compiler will enforce the 'final' keyword, 
+        //               in JS we ignore it
+        IClassNode node = getClassNode("public final class A{}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};");
+    }
+
+    @Override
+    @Test
+    public void testSimpleDynamic()
+    {
+        // (erikdebruin) all JS objects are 'dynamic' by design
+        IClassNode node = getClassNode("public dynamic class A{}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};");
+    }
+
+    @Override
+    @Test
+    public void testConstructor_super()
+    {
+        IClassNode node = getClassNode("public class A {public function A() { super(); }}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n  ;\n};");
+    }
+
+    @Override
+    @Test
+    public void testSimpleExtends()
+    {
+        IClassNode node = getClassNode("public class A extends Button {public function A() {}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n */\norg.apache.flex.A = function() {\n  org.apache.flex.A.base(this, 'constructor');\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+    }
+
+    @Override
+    @Test
+    public void testSimpleImplements()
+    {
+        IClassNode node = getClassNode("public class A implements IEventDispatcher {public function A() {}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n * @implements {flash.events.IEventDispatcher}\n */\norg.apache.flex.A = function() {};");
+    }
+
+    @Override
+    @Test
+    public void testSimpleImplementsMultiple()
+    {
+        IClassNode node = getClassNode("public class A implements IEventDispatcher, ILogger {public function A() {}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n * @implements {flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A = function() {};");
+    }
+
+    @Override
+    @Test
+    public void testSimpleExtendsImplements()
+    {
+        IClassNode node = getClassNode("public class A extends Button implements IEventDispatcher {public function A() {}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n */\norg.apache.flex.A = function() {\n  org.apache.flex.A.base(this, 'constructor');\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+    }
+
+    @Override
+    @Test
+    public void testSimpleExtendsImplementsMultiple()
+    {
+        IClassNode node = getClassNode("public class A extends Button implements IEventDispatcher, ILogger {public function A() {}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A = function() {\n  org.apache.flex.A.base(this, 'constructor');\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+    }
+
+    @Override
+    @Test
+    public void testSimpleFinalExtendsImplementsMultiple()
+    {
+        IClassNode node = getClassNode("public final class A extends Button implements IEventDispatcher, ILogger {public function A() {}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A = function() {\n  org.apache.flex.A.base(this, 'constructor');\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+    }
+
+    @Override
+    @Test
+    public void testQualifiedExtendsImplementsMultiple()
+    {
+        IClassNode node = getClassNode("public class A extends spark.components.Button implements flash.events.IEventDispatcher, mx.logging.ILogger {public function A() {}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A = function() {\n  org.apache.flex.A.base(this, 'constructor');\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+    }
+
+    @Override
+    @Test
+    public void testConstructor()
+    {
+        IClassNode node = getClassNode("public class A {public function A() { }}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};");
+    }
+
+    @Override
+    @Test
+    public void testExtendsConstructor_super()
+    {
+        IClassNode node = getClassNode("public class A extends spark.components.Button { public function A() { super('foo', 42);}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n */\norg.apache.flex.A = function() {\n  org.apache.flex.A.base(this, 'constructor', 'foo', 42);\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+    }
+
+    @Override
+    @Test
+    public void testConstructor_withArguments()
+    {
+        IClassNode node = getClassNode("public class A {public function A(arg1:String, arg2:int) {}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n * @param {string} arg1\n * @param {number} arg2\n */\norg.apache.flex.A = function(arg1, arg2) {};");
+    }
+
+    @Test
+    public void testConstructor_withArgumentNameMatchingMemberName()
+    {
+        IClassNode node = getClassNode("public class B {public function B(arg1:String) {this.arg1 = arg1}; public var arg1:String;}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n * @param {string} arg1\n */\norg.apache.flex.B = function(arg1) {\n  this.arg1 = arg1;\n};\n\n\n/**\n * @type {string}\n */\norg.apache.flex.B.prototype.arg1;";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_withImplicitSelfInReturnValue()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; public var button:Button = new Button(); public function foo():String {return button.label;};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n  this.button = new spark.components.Button();\n};\n\n\n/**\n * @type {spark.components.Button}\n */\norg.apache.flex.B.prototype.button;\n\n\n/**\n * @export\n * @return {string}\n */\norg.apache.flex.B.prototype.foo = function() {\n  return this.button.get_label();\n};";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_noArgsNoReturn()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; public function foo():void {};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n */\norg.apache.flex.B.prototype.foo = function() {\n};";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_override()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; override public function foo():void {};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @override\n */\norg.apache.flex.B.prototype.foo = function() {\n};";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_overrideWithFunctionBody()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; override public function foo(value:Object):void {baz = ''};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @param {Object} value\n * @override\n */\norg.apache.flex.B.prototype.foo = function(value) {\n  baz = '';\n};";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_overrideSuperCall()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; override public function foo():void {super.foo();};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @override\n */\norg.apache.flex.B.prototype.foo = function() {\n  org.apache.flex.B.base(this, 'foo');\n};";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_setterCall()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; public function set baz(value:Object):void {}; public function set foo(value:Object):void {baz = value;};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.B.prototype.set_baz = function(value) {\n};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.B.prototype.set_foo = function(value) {\n  this.set_baz(value);\n};";
+        assertOut(expected);
+    }
+
+    @Test
+    public void testMethod_overrideSetterSuperCall()
+    {
+        IClassNode node = getClassNode("public class B {public function B() {}; override public function set foo(value:Object):void {super.foo = value;};}");
+        asBlockWalker.visitClass(node);
+        String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @param {Object} value\n * @override\n */\norg.apache.flex.B.prototype.set_foo = function(value) {\n  org.apache.flex.B.base(this, 'set_foo', value);\n};";
+        assertOut(expected);
+    }
+
+    @Override
+    @Test
+    public void testExtendsConstructor_withArguments()
+    {
+        IClassNode node = getClassNode("public class A extends spark.components.Button {public function A(arg1:String, arg2:int) {}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @param {string} arg1\n * @param {number} arg2\n */\norg.apache.flex.A = function(arg1, arg2) {\n  org.apache.flex.A.base(this, 'constructor', arg1, arg2);\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+    }
+
+    @Override
+    @Test
+    public void testFields()
+    {
+        IClassNode node = getClassNode("public class A {public var a:Object;protected var b:String; "
+                + "private var c:int; internal var d:uint; var e:Number}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};\n\n\n/**\n * @type {Object}\n */\norg.apache.flex.A.prototype.a;\n\n\n/**\n * @protected\n * @type {string}\n */\norg.apache.flex.A.prototype.b;\n\n\n/**\n * @private\n * @type {number}\n */\norg.apache.flex.A.prototype.c;\n\n\n/**\n * @type {number}\n */\norg.apache.flex.A.prototype.d;\n\n\n/**\n * @type {number}\n */\norg.apache.flex.A.prototype.e;");
+    }
+
+    @Test
+    public void testFieldWithEmbed()
+    {
+        IClassNode node = getClassNode("public class A {[Embed(source=\"LuminosityMaskFilter.pbj\", mimeType=\"application/octet-stream\")]\nprivate static var ShaderClass:Class;}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};\n\n\n/**\n * @private\n * @type {Object}\n */\norg.apache.flex.A.ShaderClass;");
+    }
+    
+    @Test
+    public void testFieldWithObjectAssignment()
+    {
+    	IClassNode node = getClassNode("public class A {private var controlBarGroupProperties:Object = { visible: true }; private var _visible:Boolean; public function get visible():Boolean { return _visible; }; public function set visible(value:Boolean):void { _visible = value; };}");
+    	asBlockWalker.visitClass(node);
+    	assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};\n\n\n/**\n * @private\n * @type {Object}\n */\norg.apache.flex.A.prototype.controlBarGroupProperties = {visible:true};\n\n\n/**\n * @private\n * @type {boolean}\n */\norg.apache.flex.A.prototype._visible;\n\n\n/**\n * @export\n * @return {boolean}\n */\norg.apache.flex.A.prototype.get_visible = function() {\n  return this._visible;\n};\n\n\n/**\n * @export\n * @param {boolean} value\n */\norg.apache.flex.A.prototype.set_visible = function(value) {\n  this._visible = value;\n};");
+    }
+
+    @Override
+    @Test
+    public void testConstants()
+    {
+        IClassNode node = getClassNode("public class A {"
+                + "public static const A:int = 42;"
+                + "protected static const B:Number = 42;"
+                + "private static const C:Number = 42;"
+                + "foo_bar static const C:String = 'me' + 'you';");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n  org.apache.flex.A.C = 'me' + 'you';\n};\n\n\n/**\n * @const\n * @type {number}\n */\norg.apache.flex.A.A = 42;\n\n\n/**\n * @protected\n * @const\n * @type {number}\n */\norg.apache.flex.A.B = 42;\n\n\n/**\n * @private\n * @const\n * @type {number}\n */\norg.apache.flex.A.C = 42;\n\n\n/**\n * @const\n * @type {string}\n */\norg.apache.flex.A.C;");
+    }
+
+    @Override
+    @Test
+    public void testAccessors()
+    {
+        IClassNode node = getClassNode("public class A {"
+                + "public function get foo1():Object{return null;}"
+                + "public function set foo1(value:Object):void{}"
+                + "protected function get foo2():Object{return null;}"
+                + "protected function set foo2(value:Object):void{}"
+                + "private function get foo3():Object{return null;}"
+                + "private function set foo3(value:Object):void{}"
+                + "internal function get foo5():Object{return null;}"
+                + "internal function set foo5(value:Object):void{}"
+                + "foo_bar function get foo6():Object{return null;}"
+                + "foo_bar function set foo6(value:Object):void{}" + "}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo1 = function() {\n  return null;\n};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo1 = function(value) {\n};\n\n\n/**\n * @protected\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo2 = function() {\n  return null;\n};\n\n\n/**\n * @protected\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo2 = function(value) {\n};\n\n\n/**\n * @private\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo3 = function() {\n  return null;\n};\n\n\n/**\n * @private\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo3 = function(value) {\n};\n\n\n/**\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo5 = function() {\n  return null;\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo5 = function(value) {\
 n};\n\n\n/**\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo6 = function() {\n  return null;\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo6 = function(value) {\n};");
+    }
+
+    @Override
+    @Test
+    public void testMethods()
+    {
+        IClassNode node = getClassNode("public class A {"
+                + "public function foo1():Object{return null;}"
+                + "public final function foo1a():Object{return null;}"
+                + "override public function foo1b():Object{return super.foo1b();}"
+                + "protected function foo2(value:Object):void{}"
+                + "private function foo3(value:Object):void{}"
+                + "internal function foo5(value:Object):void{}"
+                + "foo_bar function foo6(value:Object):void{}"
+                + "public static function foo7(value:Object):void{}"
+                + "foo_bar static function foo7(value:Object):void{}" + "}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1 = function() {\n  return null;\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1a = function() {\n  return null;\n};\n\n\n/**\n * @export\n * @return {Object}\n * @override\n */\norg.apache.flex.A.prototype.foo1b = function() {\n  return org.apache.flex.A.base(this, 'foo1b');\n};\n\n\n/**\n * @protected\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo2 = function(value) {\n};\n\n\n/**\n * @private\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo3 = function(value) {\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo5 = function(value) {\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo6 = function(value) {\n};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.A.foo7 = function(value) {\n};
 \n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.foo7 = function(value) {\n};");
+    }
+
+    @Test
+    public void testMethodsWithLocalFunctions()
+    {
+        IClassNode node = getClassNode("public class B {"
+                + "public function foo1():Object{function bar1():Object {return null;}; return bar1()}"
+                + "public function foo2():Object{function bar2(param1:Object):Object {return null;}; return bar2('foo');}"
+                + "}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.B.prototype.foo1 = function() {\n  function bar1() {\n    return null;\n  };\n  return goog.bind(bar1, this)();\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.B.prototype.foo2 = function() {\n  function bar2(param1) {\n    return null;\n  };\n  return goog.bind(bar2, this)('foo');\n};");
+    }
+
+    @Test
+    public void testMethodsWithLocalFunctions2()
+    {
+        IClassNode node = getClassNode("public class B {"
+                + "public var baz1:String;"
+                + "public function foo1():String{function bar1():String {return baz1;}; return bar1()}"
+                + "public function foo2():String{function bar2(param1:String):String {return param1 + baz1;}; return bar2('foo');}"
+                + "}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @type {string}\n */\norg.apache.flex.B.prototype.baz1;\n\n\n/**\n * @export\n * @return {string}\n */\norg.apache.flex.B.prototype.foo1 = function() {\n  function bar1() {\n    return this.baz1;\n  };\n  return goog.bind(bar1, this)();\n};\n\n\n/**\n * @export\n * @return {string}\n */\norg.apache.flex.B.prototype.foo2 = function() {\n  function bar2(param1) {\n    return param1 + this.baz1;\n  };\n  return goog.bind(bar2, this)('foo');\n};");
+    }
+
+    @Test
+    public void testClassWithoutConstructor()
+    {
+        /* AJH couldn't find a way to reproduce the code paths
+         * in a simple test case.  May require multiple compilation
+         * units in the same package.
+         */
+        
+        // (erikdebruin) what's wrong with this test case and/or the resulting code?
+        
+        // (erikdebruin) if you're looking for a way to test multiple cu's 
+        //               (a project), look in 'TestGoogProject' for an example
+        
+        IClassNode node = getClassNode("public class B {"
+                + "public function clone():B { return new B() }"
+                + "}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @return {org.apache.flex.B}\n */\norg.apache.flex.B.prototype.clone = function() {\n  return new org.apache.flex.B();\n};");
+    }
+
+    @Override
+    protected void addLibraries(List<File> libraries)
+    {
+        libraries.addAll(testAdapter.getLibraries(true));
+    }
+    
+    @Override
+    protected IClassNode getClassNode(String code)
+    {
+        String source = "package org.apache.flex {import flash.events.IEventDispatcher;import mx.logging.ILogger;import spark.components.Button;"
+                + code + "}";
+        IFileNode node = compileAS(source);
+        IClassNode child = (IClassNode) findFirstDescendantOfType(node,
+                IClassNode.class);
+        return child;
+    }
+
+
+    protected IBackend createBackend()
+    {
+        return new VF2JSBackend();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3dce49f/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
new file mode 100644
index 0000000..3ba79e7
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
@@ -0,0 +1,124 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.vf2js;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogExpressions;
+import org.apache.flex.compiler.internal.driver.js.vf2js.VF2JSBackend;
+import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IFunctionCallNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author Erik de Bruin
+ */
+public class TestVF2JSExpressions extends TestGoogExpressions
+{
+
+    @Ignore
+    @Override
+    @Test
+    public void testVisitLanguageIdentifierNode_SuperMember()
+    {
+        // (erikdebruin) this test doesn't make sense in VF2JS context
+        IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getNode(
+                "if (a) super.foo;", IMemberAccessExpressionNode.class);
+        asBlockWalker.visitMemberAccessExpression(node);
+        assertOut("super.foo");
+    }
+
+    @Override
+    @Test
+    public void testVisitLanguageIdentifierNode_SuperMethod_1()
+    {
+        IFunctionNode node = getMethod("function foo(){if (a) super.foo();}");
+        asBlockWalker.visitFunction(node);
+        assertOut("FalconTest_A.prototype.foo = function() {\n  if (a)\n    FalconTest_A.base(this, 'foo');\n}");
+    }
+
+    @Override
+    @Test
+    public void testVisitLanguageIdentifierNode_SuperMethod_2()
+    {
+        IFunctionNode node = getMethod("function foo(){if (a) super.foo(a, b, c);}");
+        asBlockWalker.visitFunction(node);
+        assertOut("FalconTest_A.prototype.foo = function() {\n  if (a)\n    FalconTest_A.base(this, 'foo', a, b, c);\n}");
+    }
+
+    @Override
+    @Test
+    public void testAnonymousFunctionWithParamsReturn()
+    {
+        IVariableNode node = (IVariableNode) getNode(
+                "var a:Object = function(foo:int, bar:String = 'goo'):int{return -1;};",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {Object} */ a = function(foo, bar) {\n  bar = typeof bar !== 'undefined' ? bar : 'goo';\n  return -1;\n}");
+    }
+
+    @Override
+    @Test
+    public void testAnonymousFunctionAsArgument()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getNode(
+                "addListener('foo', function(event:Object):void{doit();})",
+                IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertOut("addListener('foo', function(event) {\n  doit();\n})");
+    }
+
+    @Override
+    @Test
+    public void testVisitAs()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a as b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertOut("org.apache.flex.utils.Language.as(a, b)");
+    }
+
+    @Test
+    public void testVisitAs2()
+    {
+        IFunctionNode node = (IFunctionNode) getNode(
+                "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}");
+    }
+
+    @Override
+    @Test
+    public void testVisitBinaryOperator_Is()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a is b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertOut("org.apache.flex.utils.Language.is(a, b)");
+    }
+
+    protected IBackend createBackend()
+    {
+        return new VF2JSBackend();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3dce49f/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
new file mode 100644
index 0000000..eaa79d3
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSFile.java
@@ -0,0 +1,92 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.vf2js;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.driver.js.vf2js.VF2JSBackend;
+import org.apache.flex.compiler.internal.test.VF2JSTestBase;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.utils.ITestAdapter;
+import org.apache.flex.utils.TestAdapterFactory;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This class tests the production of valid 'goog' JS code from an external
+ * file.
+ * 
+ * @author Erik de Bruin
+ */
+public class TestVF2JSFile extends VF2JSTestBase
+{
+    private static ITestAdapter testAdapter = TestAdapterFactory.getTestAdapter();
+
+    @Ignore
+    @Test
+    public void testSimple()
+    {
+        String fileName = "SimpleAS";
+
+        IFileNode node = compileAS(fileName, true,
+                new File(testAdapter.getUnitTestBaseDir(), "vf2js/files").getPath(),
+                false);
+        
+        asBlockWalker.visitFile(node);
+        
+        //writeResultToFile(writer.toString(), fileName);
+        
+        assertOut(getCodeFromFile(fileName + "_result", true,
+                "vf2js" + File.separator + "files"));
+    }
+	
+    @Test
+    public void testVersion()
+    {
+        String fileName = "Version";
+
+        IFileNode node = compileAS(fileName, true,
+                new File(testAdapter.getUnitTestBaseDir(), "vf2js/files").getPath(),
+                false);
+        
+        asBlockWalker.visitFile(node);
+        
+        //writeResultToFile(writer.toString(), fileName);
+        
+        assertOut(getCodeFromFile(fileName + "_result", true,
+                "vf2js" + File.separator + "files"));
+    }
+
+    @Override
+    protected void addSourcePaths(List<File> sourcePaths)
+    {
+        sourcePaths.add(new File(testAdapter.getUnitTestBaseDir(), "vf2js/files"));
+
+        super.addSourcePaths(sourcePaths);
+    }
+
+    @Override
+    protected IBackend createBackend()
+    {
+        return new VF2JSBackend();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3dce49f/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
new file mode 100644
index 0000000..fad2b93
--- /dev/null
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSProject.java
@@ -0,0 +1,131 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.vf2js;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogProject;
+import org.apache.flex.compiler.internal.driver.js.vf2js.VF2JSBackend;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
+import org.apache.flex.utils.FilenameNormalization;
+import org.apache.flex.utils.TestAdapterFactory;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This class tests the production of valid 'vf2js' JS code from an external
+ * project.
+ * 
+ * @author Erik de Bruin
+ */
+public class TestVF2JSProject extends TestGoogProject
+{
+
+    private static String projectDirPath = "vf2js/projects";
+
+    @Override
+    public void setUp()
+    {
+        project = new FlexJSProject(workspace);
+
+        super.setUp();
+    }
+    
+    @Ignore
+    @Test
+    public void test_imports()
+    {
+        // crude bypass to allow for successful inheritance
+    }
+
+    @Test
+    public void test_Test()
+    {
+        String testDirPath = projectDirPath + "/interfaces";
+
+        String fileName = "Test";
+
+        List<String> compiledFileNames = compileProject(fileName, testDirPath);
+
+        assertProjectOut(compiledFileNames, testDirPath);
+    }
+
+    @Test
+    @Ignore
+    public void test_SDKTricks()
+    {
+        String testDirPath = projectDirPath + "/sdk";
+
+        String fileName = "SomeSDKClass";
+
+        List<String> compiledFileNames = compileProject(fileName, testDirPath);
+
+        assertProjectOut(compiledFileNames, testDirPath);
+    }
+
+    @Test
+    public void test_Super()
+    {
+        String testDirPath = projectDirPath + "/super";
+
+        String fileName = "Base";
+
+        List<String> compiledFileNames = compileProject(fileName, testDirPath);
+
+        assertProjectOut(compiledFileNames, testDirPath);
+    }
+
+    @Override
+    protected void addSourcePaths(List<File> sourcePaths)
+    {
+        sourcePaths.add(new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(),
+                projectDirPath + "/interfaces"));
+
+        sourcePaths.add(new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(),
+                projectDirPath + "/sdk"));
+
+        sourcePaths.add(new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(),
+                projectDirPath + "/super"));
+
+        super.addSourcePaths(sourcePaths);
+    }
+
+    @Override
+    protected void addLibraries(List<File> libraries)
+    {
+        libraries.add(new File(FilenameNormalization.normalize(env.FPSDK
+                + "/" + env.FPVER + "/playerglobal.swc")));
+        libraries.add(new File(FilenameNormalization.normalize(env.SDK
+                + "/frameworks/libs/framework.swc")));
+        libraries.add(new File(FilenameNormalization.normalize(env.SDK
+                + "/frameworks/libs/spark.swc")));
+
+        super.addLibraries(libraries);
+    }
+
+    @Override
+    protected IBackend createBackend()
+    {
+        return new VF2JSBackend();
+    }
+
+}


Mime
View raw message