flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1452955 [2/9] - in /flex/falcon/trunk: compiler.jx.tests/src/org/apache/flex/compiler/internal/as/ compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/ compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/ compile...
Date Tue, 05 Mar 2013 19:22:09 GMT
Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestInterface.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestInterface.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestInterface.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestInterface.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,105 @@
+/*
+ *
+ *  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.as;
+
+import org.apache.flex.compiler.internal.test.ASTestBase;
+import org.apache.flex.compiler.tree.as.IInterfaceNode;
+import org.junit.Test;
+
+/**
+ * This class tests the production of valid ActionScript3 code for Interface
+ * production.
+ * 
+ * @author Michael Schmalle
+ */
+public class TestInterface extends ASTestBase
+{
+    //--------------------------------------------------------------------------
+    // Interface
+    //--------------------------------------------------------------------------
+
+    @Test
+    public void testSimple()
+    {
+        IInterfaceNode node = getInterfaceNode("public interface IA{}");
+        asBlockWalker.visitInterface(node);
+        assertOut("public interface IA {\n}");
+    }
+
+    @Test
+    public void testSimpleExtends()
+    {
+        IInterfaceNode node = getInterfaceNode("public interface IA extends IB{}");
+        asBlockWalker.visitInterface(node);
+        assertOut("public interface IA extends IB {\n}");
+    }
+
+    @Test
+    public void testSimpleExtendsMultiple()
+    {
+        IInterfaceNode node = getInterfaceNode("public interface IA extends IB, IC, ID {}");
+        asBlockWalker.visitInterface(node);
+        assertOut("public interface IA extends IB, IC, ID {\n}");
+    }
+
+    @Test
+    public void testQualifiedExtendsMultiple()
+    {
+        IInterfaceNode node = getInterfaceNode("public interface IA extends foo.bar.IB, baz.goo.IC, foo.ID {}");
+        asBlockWalker.visitInterface(node);
+        assertOut("public interface IA extends foo.bar.IB, baz.goo.IC, foo.ID {\n}");
+    }
+
+    @Test
+    public void testAccessors()
+    {
+        IInterfaceNode node = getInterfaceNode("public interface IA {"
+                + "function get foo1():Object;"
+                + "function set foo1(value:Object):void;}");
+        asBlockWalker.visitInterface(node);
+        assertOut("public interface IA {\n\tfunction get foo1():Object;\n\t"
+                + "function set foo1(value:Object):void;\n}");
+    }
+
+    @Test
+    public void testMethods()
+    {
+        IInterfaceNode node = getInterfaceNode("public interface IA {"
+                + "function foo1():Object;"
+                + "function foo1(value:Object):void;}");
+        asBlockWalker.visitInterface(node);
+        assertOut("public interface IA {\n\tfunction foo1():Object;\n\t"
+                + "function foo1(value:Object):void;\n}");
+    }
+
+    @Test
+    public void testAccessorsMethods()
+    {
+        IInterfaceNode node = getInterfaceNode("public interface IA {"
+                + "function get foo1():Object;"
+                + "function set foo1(value:Object):void;"
+                + "function baz1():Object;"
+                + "function baz2(value:Object):void;}");
+        asBlockWalker.visitInterface(node);
+        assertOut("public interface IA {\n\tfunction get foo1():Object;"
+                + "\n\tfunction set foo1(value:Object):void;\n\tfunction baz1()"
+                + ":Object;\n\tfunction baz2(value:Object):void;\n}");
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestMethodMembers.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestMethodMembers.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestMethodMembers.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestMethodMembers.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,150 @@
+/*
+ *
+ *  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.as;
+
+import org.apache.flex.compiler.internal.test.ASTestBase;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This class tests the production of valid ActionScript3 code for Class Method
+ * members.
+ * 
+ * @author Michael Schmalle
+ */
+public class TestMethodMembers extends ASTestBase
+{
+    /*
+     * Method
+     * 
+     * function foo(){}
+     * function foo():int{}
+     * function foo(bar):int{}
+     * function foo(bar:String):int{}
+     * function foo(bar:String = "baz"):int{}
+     * function foo(bar:String, baz:int = null):int{}
+     * function foo(bar:String, ...rest):int{}
+     * public function foo(bar:String, baz:int = null):int{}
+     * public static function foo(bar:String, baz:int = null):int{}
+     */
+
+    //--------------------------------------------------------------------------
+    // Method
+    //--------------------------------------------------------------------------
+
+    @Test
+    public void testMethod()
+    {
+        IFunctionNode node = getMethod("function foo(){}");
+        asBlockWalker.visitFunction(node);
+        assertOut("function foo() {\n}");
+    }
+
+    @Test
+    public void testMethod_withReturnType()
+    {
+        IFunctionNode node = getMethod("function foo():int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("function foo():int {\n\treturn -1;\n}");
+    }
+
+    @Test
+    public void testMethod_withParameterReturnType()
+    {
+        IFunctionNode node = getMethod("function foo(bar):int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("function foo(bar:*):int {\n\treturn -1;\n}");
+    }
+
+    @Test
+    public void testMethod_withParameterTypeReturnType()
+    {
+        IFunctionNode node = getMethod("function foo(bar:String):int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("function foo(bar:String):int {\n\treturn -1;\n}");
+    }
+
+    @Test
+    public void testMethod_withDefaultParameterTypeReturnType()
+    {
+        IFunctionNode node = getMethod("function foo(bar:String = \"baz\"):int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("function foo(bar:String = \"baz\"):int {\n\treturn -1;\n}");
+    }
+
+    @Test
+    public void testMethod_withMultipleDefaultParameterTypeReturnType()
+    {
+        IFunctionNode node = getMethod("function foo(bar:String, baz:int = null):int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("function foo(bar:String, baz:int = null):int {\n\treturn -1;\n}");
+    }
+
+    @Ignore
+    @Test
+    public void testMethod_withRestParameterTypeReturnType()
+    {
+        // TODO (mschmalle) handle ...rest parameter correctly
+        IFunctionNode node = getMethod("function foo(bar:String, ...rest):int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("function foo(bar:String, ...rest):int {\n\treturn -1;\n}");
+    }
+
+    @Test
+    public void testMethod_withNamespace()
+    {
+        IFunctionNode node = getMethod("public function foo(bar:String, baz:int = null):int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("public function foo(bar:String, baz:int = null):int {\n\treturn -1;\n}");
+    }
+
+    @Test
+    public void testMethod_withNamespaceCustom()
+    {
+        IFunctionNode node = getMethod("mx_internal function foo(bar:String, baz:int = null):int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("mx_internal function foo(bar:String, baz:int = null):int {\n\treturn -1;\n}");
+    }
+
+    @Test
+    public void testMethod_withNamespaceModifiers()
+    {
+        IFunctionNode node = getMethod("public static function foo(bar:String, baz:int = null):int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("public static function foo(bar:String, baz:int = null):int {\n\treturn -1;\n}");
+    }
+
+    @Test
+    public void testMethod_withNamespaceModifierOverride()
+    {
+        IFunctionNode node = getMethod("public override function foo(bar:String, baz:int = null):int{\treturn -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("public override function foo(bar:String, baz:int = null):int {\n\treturn -1;\n}");
+    }
+
+    @Test
+    public void testMethod_withNamespaceModifierOverrideBackwards()
+    {
+        IFunctionNode node = getMethod("override public function foo(bar:String, baz:int = null):int{return -1;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("public override function foo(bar:String, baz:int = null):int {\n\treturn -1;\n}");
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestMethodMembers.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestPackage.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestPackage.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestPackage.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestPackage.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,105 @@
+/*
+ *
+ *  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.as;
+
+import org.apache.flex.compiler.internal.test.ASTestBase;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This class tests the production of valid ActionScript3 code for Package
+ * production.
+ * 
+ * @author Michael Schmalle
+ */
+public class TestPackage extends ASTestBase
+{
+    //--------------------------------------------------------------------------
+    // Package
+    //--------------------------------------------------------------------------
+
+    @Test
+    public void testPackage_Simple()
+    {
+        IFileNode node = compileAS("package{}");
+        asBlockWalker.visitFile(node);
+        assertOut("package {\n}");
+    }
+
+    @Test
+    public void testPackage_SimpleName()
+    {
+        IFileNode node = compileAS("package foo {}");
+        asBlockWalker.visitFile(node);
+        assertOut("package foo {\n}");
+    }
+
+    @Test
+    public void testPackage_Name()
+    {
+        IFileNode node = compileAS("package foo.bar.baz {}");
+        asBlockWalker.visitFile(node);
+        assertOut("package foo.bar.baz {\n}");
+    }
+
+    @Test
+    public void testPackageSimple_Class()
+    {
+        IFileNode node = compileAS("package {public class A{}}");
+        asBlockWalker.visitFile(node);
+        assertOut("package {\n\tpublic class A {\n\t}\n}");
+    }
+
+    @Test
+    public void testPackageQualified_Class()
+    {
+        IFileNode node = compileAS("package foo.bar.baz {public class A{}}");
+        asBlockWalker.visitFile(node);
+        assertOut("package foo.bar.baz {\n\tpublic class A {\n\t}\n}");
+    }
+
+    @Test
+    public void testPackageQualified_ClassBody()
+    {
+        IFileNode node = compileAS("package foo.bar.baz {public class A{public function A(){}}}");
+        asBlockWalker.visitFile(node);
+        assertOut("package foo.bar.baz {\n\tpublic class A {\n\t\tpublic function A() {\n\t\t}\n\t}\n}");
+    }
+
+    @Test
+    public void testPackageQualified_ClassBodyMethodContents()
+    {
+        IFileNode node = compileAS("package foo.bar.baz {public class A{public function A(){if (a){for each(var i:Object in obj){doit();}}}}}");
+        asBlockWalker.visitFile(node);
+        assertOut("package foo.bar.baz {\n\tpublic class A {\n\t\tpublic function A() {\n\t\t\t"
+                + "if (a) {\n\t\t\t\tfor each (var i:Object in obj) {\n\t\t\t\t\tdoit();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}");
+    }
+
+    @Ignore
+    @Test
+    public void testPackage_Import()
+    {
+        // TODO (mschmalle) implement Import unit tests for as
+        IFileNode node = compileAS("package{import foo.bar.Baz;}");
+        asBlockWalker.visitFile(node);
+        assertOut("package {\nimport foo.bar.Baz;}");
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestPackage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestStatements.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestStatements.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestStatements.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestStatements.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,456 @@
+/*
+ *
+ *  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.as;
+
+import org.apache.flex.compiler.internal.test.ASTestBase;
+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.IIfNode;
+import org.apache.flex.compiler.tree.as.ISwitchNode;
+import org.apache.flex.compiler.tree.as.IThrowNode;
+import org.apache.flex.compiler.tree.as.ITryNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.apache.flex.compiler.tree.as.IWhileLoopNode;
+import org.apache.flex.compiler.tree.as.IWithNode;
+import org.junit.Test;
+
+/**
+ * @author Michael Schmalle
+ */
+public class TestStatements extends ASTestBase
+{
+    //--------------------------------------------------------------------------
+    // if
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    // var declaration
+    //----------------------------------
+
+    @Test
+    public void testVarDeclaration()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("var a:*");
+    }
+
+    @Test
+    public void testVarDeclaration_withType()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a:int;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("var a:int");
+    }
+
+    @Test
+    public void testVarDeclaration_withTypeAssignedValue()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a:int = 42;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("var a:int = 42");
+    }
+
+    @Test
+    public void testVarDeclaration_withTypeAssignedValueComplex()
+    {
+        IVariableNode node = (IVariableNode) getNode(
+                "var a:Foo = new Foo(42, 'goo');", IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("var a:Foo = new Foo(42, 'goo')");
+    }
+
+    @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 a:int = 4, b:int = 11, c:int = 42");
+    }
+
+    //----------------------------------
+    // const declaration
+    //----------------------------------
+
+    @Test
+    public void testConstDeclaration()
+    {
+        IVariableNode node = (IVariableNode) getNode("const a = 42;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("const a:* = 42");
+    }
+
+    @Test
+    public void testConstDeclaration_withType()
+    {
+        IVariableNode node = (IVariableNode) getNode("const a:int = 42;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        assertOut("const a:int = 42");
+    }
+
+    @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("const a:int = 4, b:int = 11, c:int = 42");
+    }
+
+    //----------------------------------
+    // if ()
+    //----------------------------------
+
+    @Test
+    public void testVisitIf_1()
+    {
+        IIfNode node = (IIfNode) getNode("if (a) b++;", IIfNode.class);
+        asBlockWalker.visitIf(node);
+        assertOut("if (a)\n\tb++;");
+    }
+
+    @Test
+    public void testVisitIf_2()
+    {
+        IIfNode node = (IIfNode) getNode("if (a) b++; else c++;", IIfNode.class);
+        asBlockWalker.visitIf(node);
+        assertOut("if (a)\n\tb++;\nelse\n\tc++;");
+    }
+
+    @Test
+    public void testVisitIf_4()
+    {
+        IIfNode node = (IIfNode) getNode(
+                "if (a) b++; else if (c) d++; else if(e) --f;", IIfNode.class);
+        asBlockWalker.visitIf(node);
+        assertOut("if (a)\n\tb++;\nelse if (c)\n\td++;\nelse if (e)\n\t--f;");
+    }
+
+    //----------------------------------
+    // if () { }
+    //----------------------------------
+
+    @Test
+    public void testVisitIf_1a()
+    {
+        IIfNode node = (IIfNode) getNode("if (a) { b++; }", IIfNode.class);
+        asBlockWalker.visitIf(node);
+        assertOut("if (a) {\n\tb++;\n}");
+    }
+
+    @Test
+    public void testVisitIf_1b()
+    {
+        IIfNode node = (IIfNode) getNode("if (a) { b++; } else { c++; }",
+                IIfNode.class);
+        asBlockWalker.visitIf(node);
+        assertOut("if (a) {\n\tb++;\n} else {\n\tc++;\n}");
+    }
+
+    @Test
+    public void testVisitIf_1c()
+    {
+        IIfNode node = (IIfNode) getNode(
+                "if (a) { b++; } else if (b) { c++; } else { d++; }",
+                IIfNode.class);
+        asBlockWalker.visitIf(node);
+        assertOut("if (a) {\n\tb++;\n} else if (b) {\n\tc++;\n} else {\n\td++;\n}");
+    }
+
+    @Test
+    public void testVisitIf_3()
+    {
+        IIfNode node = (IIfNode) getNode(
+                "if (a) b++; else if (c) d++; else --e;", IIfNode.class);
+        asBlockWalker.visitIf(node);
+        assertOut("if (a)\n\tb++;\nelse if (c)\n\td++;\nelse\n\t--e;");
+    }
+
+    //----------------------------------
+    // for () { }
+    //----------------------------------
+
+    @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 i:int = 0; i < len; i++) {\n\tbreak;\n}");
+    }
+
+    @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 i:int = 0; i < len; i++)\n\tbreak;");
+    }
+
+    @Test
+    public void testVisitFor_2()
+    {
+        IForLoopNode node = (IForLoopNode) getNode("for (;;) { break; }",
+                IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("for (;;) {\n\tbreak;\n}");
+    }
+
+    @Test
+    public void testVisitForIn_1()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int in obj) { break; }", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("for (var i:int in obj) {\n\tbreak;\n}");
+    }
+
+    @Test
+    public void testVisitForIn_1a()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int in obj)  break; ", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("for (var i:int in obj)\n\tbreak;");
+    }
+
+    @Test
+    public void testVisitForEach_1()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for each(var i:int in obj) { break; }", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("for each (var i:int in obj) {\n\tbreak;\n}");
+    }
+
+    @Test
+    public void testVisitForEach_1a()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for each(var i:int in obj)  break; ", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        assertOut("for each (var i:int in obj)\n\tbreak;");
+    }
+
+    //----------------------------------
+    // while () { }
+    //----------------------------------
+
+    @Test
+    public void testVisitWhileLoop_1()
+    {
+        IWhileLoopNode node = (IWhileLoopNode) getNode(
+                "while(a > b){a++;--b;}", IWhileLoopNode.class);
+        asBlockWalker.visitWhileLoop(node);
+        assertOut("while (a > b) {\n\ta++;\n\t--b;\n}");
+    }
+
+    @Test
+    public void testVisitWhileLoop_1a()
+    {
+        IWhileLoopNode node = (IWhileLoopNode) getNode("while(a > b) a++;",
+                IWhileLoopNode.class);
+        asBlockWalker.visitWhileLoop(node);
+        assertOut("while (a > b)\n\ta++;");
+    }
+
+    //----------------------------------
+    // do {} while ()
+    //----------------------------------
+
+    @Test
+    public void testVisitWhileLoop_Do_1()
+    {
+        IWhileLoopNode node = (IWhileLoopNode) getNode(
+                "do {a++;--b;} while(a > b);", IWhileLoopNode.class);
+        asBlockWalker.visitWhileLoop(node);
+        assertOut("do {\n\ta++;\n\t--b;\n} while (a > b);");
+    }
+
+    @Test
+    public void testVisitWhileLoop_Do_1a()
+    {
+        IWhileLoopNode node = (IWhileLoopNode) getNode("do a++; while(a > b);",
+                IWhileLoopNode.class);
+        asBlockWalker.visitWhileLoop(node);
+        assertOut("do\n\ta++;\nwhile (a > b);");
+    }
+
+    //----------------------------------
+    // throw ()
+    //----------------------------------
+
+    @Test
+    public void testVisitThrow()
+    {
+        IThrowNode node = (IThrowNode) getNode("throw new Error('foo');",
+                IThrowNode.class);
+        asBlockWalker.visitThrow(node);
+        assertOut("throw new Error('foo')");
+    }
+
+    //----------------------------------
+    // try {} catch () {} finally {}
+    //----------------------------------
+
+    @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:Error) {\n\tb;\n}");
+    }
+
+    @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:Error) {\n\tb;\n} finally {\n\tc;\n}");
+    }
+
+    @Test
+    public void testVisitTry_Catch_Catch_Finally()
+    {
+        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:Error) {\n\tb;\n} catch (f:Error) {\n\tc;\n} finally {\n\td;\n}");
+    }
+
+    @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:Error) {\n} finally {\n}");
+    }
+
+    //----------------------------------
+    // switch {}
+    //----------------------------------
+
+    @Test
+    public void testVisitSwitch_1()
+    {
+        ISwitchNode node = (ISwitchNode) getNode("switch(i){case 1: break;}",
+                ISwitchNode.class);
+        asBlockWalker.visitSwitch(node);
+        assertOut("switch (i) {\n\tcase 1:\n\t\tbreak;\n}");
+    }
+
+    @Test
+    public void testVisitSwitch_1a()
+    {
+        ISwitchNode node = (ISwitchNode) getNode(
+                "switch(i){case 1: { break; }}", ISwitchNode.class);
+        asBlockWalker.visitSwitch(node);
+        // TODO case BLOCK statements are SYNTHESIZED so they will never show BRACES
+        // without extra help from us
+        assertOut("switch (i) {\n\tcase 1:\n\t\tbreak;\n}");
+    }
+
+    @Test
+    public void testVisitSwitch_2()
+    {
+        ISwitchNode node = (ISwitchNode) getNode(
+                "switch(i){case 1: break; default: return;}", ISwitchNode.class);
+        asBlockWalker.visitSwitch(node);
+        assertOut("switch (i) {\n\tcase 1:\n\t\tbreak;\n\tdefault:\n\t\treturn;\n}");
+    }
+
+    //----------------------------------
+    // label : for () {}
+    //----------------------------------
+
+    @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 : for each (var i:int in obj) {\n\tbreak foo;\n}");
+    }
+
+    @Test
+    public void testVisitLabel_1a()
+    {
+        // TODO LabelStatement messes up in finally{} block, something is wrong there
+        LabeledStatementNode node = (LabeledStatementNode) getNode(
+                "foo: for each(var i:int in obj) break foo;",
+                LabeledStatementNode.class);
+        asBlockWalker.visitLabeledStatement(node);
+        assertOut("foo : for each (var i:int in obj)\n\tbreak foo;");
+    }
+
+    //----------------------------------
+    // with () {}
+    //----------------------------------
+
+    @Test
+    public void testVisitWith()
+    {
+        IWithNode node = (IWithNode) getNode("with (a) { b; }", IWithNode.class);
+        asBlockWalker.visitWith(node);
+        assertOut("with (a) {\n\tb;\n}");
+    }
+
+    @Test
+    public void testVisitWith_1a()
+    {
+        IWithNode node = (IWithNode) getNode("with (a) b;", IWithNode.class);
+        asBlockWalker.visitWith(node);
+        assertOut("with (a)\n\tb;");
+    }
+
+    @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;}"
+                        + " } catch (f:Error) { c; eee.dd; } 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("package {\n\tpublic class A {\n\t\tfunction a():void {\n\t\t\ttry {\n\t\t\t\ta;\n\t\t\t} catch (e:Error) {\n\t\t\t\tif (a) {\n\t\t\t\t\tif (b) {\n\t\t\t\t\t\tif (c)\n\t\t\t\t\t\t\tb;\n\t\t\t\t\t\telse if (f)\n\t\t\t\t\t\t\ta;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\te;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t}\n\t\t\tif (d)\n\t\t\t\tfor (var i:int = 0; i < len; i++)\n\t\t\t\t\tbreak;\n\t\t\tif (a) {\n\t\t\t\twith (ab) {\n\t\t\t\t\tc();\n\t\t\t\t}\n\t\t\t\tdo {\n\t\t\t\t\ta++;\n\t\t\t\t\tdo\n\t\t\t\t\t\ta++;\n\t\t\t\t\twhile (a > b);\n\t\t\t\t} while (c > d);\n\t\t\t}\n\t\t\tif (b) {\n\t\t\t\ttry {\n\t\t\t\t\ta;\n\t\t\t\t\tthrow new Error('foo');\n\t\t\t\t} catch (e:Error) {\n\t\t\t\t\tswitch (i) {\n\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} catch (f:Error) {\n\t\t\t\t\tc;\n\t\t\t\t\teee.dd;\n\t\t\t\t} finally {\n\t\t\t\t\td;\n\t\t\t\t\tvar a:Object = function(foo:int, bar:String = 'goo')
 :int {\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t};\n\t\t\t\t\teee.dd;\n\t\t\t\t\teee.dd;\n\t\t\t\t\teee.dd;\n\t\t\t\t\teee.dd;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfoo : for each (var i:int in obj)\n\t\t\t\tbreak foo;;\n\t}\n}\n}");
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestStatements.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDClassA.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDClassA.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDClassA.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDClassA.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,179 @@
+/*
+ *
+ *  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.amd;
+
+import org.apache.flex.compiler.internal.test.AMDTestBase;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IGetterNode;
+import org.apache.flex.compiler.tree.as.ISetterNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.junit.Test;
+
+/**
+ * This class tests the production of AMD JavaScript for the test project, class
+ * A.
+ * 
+ * @author Michael Schmalle
+ */
+public class TestAMDClassA extends AMDTestBase
+{
+    // !!! the errors have to do with how I change 'this' on member expressions
+
+    //--------------------------------------------------------------------------
+    // Class A
+    //--------------------------------------------------------------------------
+
+    @Test
+    public void test_field_msg()
+    {
+        IVariableNode vnode = findField("_msg", classNode);
+        asBlockWalker.visitVariable(vnode);
+        assertOut("_msg$1: {\n\tvalue:0,\n\twritable:true\n}");
+    }
+
+    @Test
+    public void test_constructor()
+    {
+        IFunctionNode vnode = findFunction("A", classNode);
+        asBlockWalker.visitFunction(vnode);
+        assertOut("function A(msg) {\n\tthis.msg = msg;\n}");
+    }
+
+    @Test
+    public void test_get_msg()
+    {
+        IGetterNode node = findGetter("msg", classNode);
+        asBlockWalker.visitGetter(node);
+        assertOut("msg: {\n\tget: function msg$get() {\n\t\treturn String(this._msg$1);\n\t},"
+                + "\n\tset: function msg$set(value) {\n\t\tthis._msg$1 = parseInt(value, 10);\n\t}\n}");
+    }
+
+    @Test
+    public void test_set_msg()
+    {
+        ISetterNode node = findSetter("msg", classNode);
+        asBlockWalker.visitSetter(node);
+        assertOut("msg: {\n\tget: function msg$get() {\n\t\treturn String(this._msg$1);\n\t},"
+                + "\n\tset: function msg$set(value) {\n\t\tthis._msg$1 = parseInt(value, 10);\n\t}\n}");
+    }
+
+    @Test
+    public void test_secret()
+    {
+        IFunctionNode vnode = findFunction("secret", classNode);
+        asBlockWalker.visitFunction(vnode);
+        assertOut("secret$1: function secret(n) {\n\treturn this.msg + n;\n}");
+    }
+
+    @Test
+    public void test_foo()
+    {
+        IFunctionNode vnode = findFunction("foo", classNode);
+        asBlockWalker.visitFunction(vnode);
+        assertOut("foo: function foo(x) {\n\treturn this.secret$1(A.bar(x));\n}");
+    }
+
+    @Test
+    public void test_baz()
+    {
+        IFunctionNode vnode = findFunction("baz", classNode);
+        asBlockWalker.visitFunction(vnode);
+        assertOut("baz: function baz() {\n\tvar tmp = AS3.bind(this, "
+                + "\"secret$1\");\n\treturn tmp(\"-bound\");\n}");
+    }
+
+    @Test
+    public void test_bar()
+    {
+        IFunctionNode vnode = findFunction("bar", classNode);
+        asBlockWalker.visitFunction(vnode);
+        assertOut("bar: function bar(x) {\n\treturn x + 1;\n}");
+    }
+
+    @Test
+    public void test_file()
+    {
+        // not going to put this test production in until everything is concrete and agreed upon
+        asBlockWalker.visitFile(fileNode);
+        //assertOut("");
+    }
+
+    @Override
+    protected String getTypeUnderTest()
+    {
+        return "com.acme.A";
+    }
+}
+
+/*
+
+--------------------------------------------------------------------------------
+02-07-2013
+Current Production of visitFile()
+--------------------------------------------------------------------------------
+
+define(["exports", "runtime/AS3", "classes/I", "classes/String", "classes/parseInt", "classes/trace"], function($exports, AS3, I, String, parseInt, trace) {
+    "use strict"; 
+    AS3.compilationUnit($exports, function($primaryDeclaration){
+        function A(msg) {
+            this.msg = msg;
+        }
+        $primaryDeclaration(AS3.class_({
+            package_: "com.acme",
+            class_: "A",
+            implements_: [
+                I
+            ],
+            members: {
+                constructor: A,
+                _msg$1: {
+                    value:0,
+                    writable:true
+                },
+                msg: {
+                    get: function msg$get() {
+                        return String(this._msg$1);
+                    },
+                    set: function msg$set(value) {
+                        this._msg$1 = parseInt(value, 10);
+                    }
+                },
+                secret$1: function secret(n) {
+                    return this.msg + n;
+                },
+                foo: function foo(x) {
+                    return this.secret$1(A.bar(x));
+                },
+                baz: function baz() {
+                    var tmp = AS3.bind(this, "secret$1");
+                    return tmp("-bound");
+                }
+            },
+            staticMembers: {
+                bar: function bar(x) {
+                    return x + 1;
+                }
+            }
+        }));
+        trace("Class A is initialized!");
+    });
+});
+
+*/

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDClassA.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDClassB.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDClassB.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDClassB.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDClassB.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,94 @@
+/*
+ *
+ *  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.amd;
+
+import org.apache.flex.compiler.internal.test.AMDTestBase;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.junit.Test;
+
+/**
+ * This class tests the production of AMD JavaScript for the test project, class
+ * B.
+ * 
+ * @author Michael Schmalle
+ */
+public class TestAMDClassB extends AMDTestBase
+{
+    //--------------------------------------------------------------------------
+    // Class B
+    //--------------------------------------------------------------------------
+
+    @Test
+    public void test_nowPlusOne()
+    {
+        IFunctionNode vnode = findFunction("nowPlusOne", classNode);
+        asBlockWalker.visitFunction(vnode);
+        assertOut("nowPlusOne: function nowPlusOne() {\n\treturn new Date(B.now.getTime() + 60 * 60 * 1000);\n}");
+    }
+
+    @Test
+    public void test_constructor()
+    {
+        IFunctionNode vnode = findFunction("B", classNode);
+        asBlockWalker.visitFunction(vnode);
+        assertOut("function B(msg, count) {\n\tthis.barfoo = (A._ || A._$get()).bar(3);"
+                + "\n\tSuper.call(this, msg);\n\tthis.count = count;\n\ttrace(\"now: \" + B.now);\n}");
+    }
+
+    @Test
+    public void test_count()
+    {
+        IVariableNode node = findField("count", classNode);
+        asBlockWalker.visitVariable(node);
+        assertOut("count: {\n\tvalue:0,\n\twritable:true\n}");
+    }
+
+    @Test
+    public void test_override_foo()
+    {
+        IFunctionNode vnode = findFunction("foo", classNode);
+        asBlockWalker.visitFunction(vnode);
+        assertOut("foo: function foo(x) {\n\treturn this.foo$2(x + 2) + \"-sub\";\n}");
+    }
+
+    @Test
+    public void test_now()
+    {
+        IVariableNode node = findField("now", classNode);
+        asBlockWalker.visitVariable(node);
+        assertOut("B.now = new Date()");
+    }
+
+    @Test
+    public void test_file()
+    {
+        // not going to put this test production in until everything is concrete and agreed upon
+        asBlockWalker.visitFile(fileNode);
+        //assertOut("");
+    }
+
+    @Override
+    protected String getTypeUnderTest()
+    {
+        return "com.acme.B";
+    }
+
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDClassB.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmiter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmiter.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmiter.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmiter.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,152 @@
+/*
+ *
+ *  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.amd;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.driver.js.amd.AMDBackend;
+import org.apache.flex.compiler.internal.test.ASTestBase;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This class tests the production of 'AMD' JavaScript output.
+ * <p>
+ * Note; this is a complete prototype more used in figuring out where
+ * abstraction and indirection is needed concerning the AS -> JS translations.
+ * 
+ * @author Michael Schmalle
+ */
+public class TestAMDEmiter extends ASTestBase
+{
+    @Ignore
+    @Test
+    public void testSimple()
+    {
+        String code = "package com.example.components {"
+                + "import org.apache.flex.html.staticControls.TextButton;"
+                + "public class MyTextButton extends TextButton {"
+                + "public function MyTextButton() {if (foo() != 42) { bar(); } }"
+                + "private var _privateVar:String = \"do \";"
+                + "public var publicProperty:Number = 100;"
+                + "public function myFunction(value: String): String{"
+                + "return \"Don't \" + _privateVar + value; }";
+        IFileNode node = compileAS(code);
+        asBlockWalker.visitFile(node);
+        assertOut("package com.example.components {\n\tpublic class MyTextButton extends TextButton {\n\t\tcom.example.components.MyTextButton = function() {\n\t\t\tif (foo() != 42) {\n\t\t\t\tbar();\n\t\t\t}\n\t\t}\n\t\tprivate var _privateVar:String = \"do \";\n\t\tpublic var publicProperty:Number = 100;\n\t\tcom.example.components.MyTextButton.prototype.myFunction = function(value) {\n\t\t\treturn \"Don't \" + _privateVar + value;\n\t\t}\n\t}\n}");
+    }
+
+    @Ignore
+    @Test
+    public void testSimpleMethod()
+    {
+        IFunctionNode node = getMethod("function method1():void{\n}");
+        asBlockWalker.visitFunction(node);
+        assertOut("A.prototype.method1 = function() {\n}");
+    }
+
+    @Ignore
+    @Test
+    public void testSimpleParameterReturnType()
+    {
+        IFunctionNode node = getMethod("function method1(bar:int):int{\n}");
+        asBlockWalker.visitFunction(node);
+        assertOut("A.prototype.method1 = function(bar) {\n}");
+    }
+
+    @Ignore
+    @Test
+    public void testSimpleMultipleParameter()
+    {
+        IFunctionNode node = getMethod("function method1(bar:int, baz:String, goo:A):void{\n}");
+        asBlockWalker.visitFunction(node);
+        assertOut("A.prototype.method1 = function(bar, baz, goo) {\n}");
+    }
+
+    @Ignore
+    @Test
+    public void testDefaultParameter()
+    {
+        /*
+         foo.bar.A.method1 = function(p1, p2, p3, p4) {
+            if (arguments.length < 4) {
+                if (arguments.length < 3) {
+                    p3 = 3;
+                }
+                p4 = 4;
+            }
+            return p1 + p2 + p3 + p4;
+         }
+         */
+        IFunctionNode node = getMethod("function method1(p1:int, p2:int, p3:int = 3, p4:int = 4):int{return p1 + p2 + p3 + p4;}");
+        asBlockWalker.visitFunction(node);
+        assertOut("A.prototype.method1 = function(p1, p2, p3, p4) {\n\tif (arguments.length < 4) "
+                + "{\n\t\tif (arguments.length < 3) {\n\t\t\tp3 = 3;\n\t\t}\n\t\tp4 = 4;\n\t}"
+                + "\n\treturn p1 + p2 + p3 + p4;\n}");
+    }
+
+    @Ignore
+    @Test
+    public void testDefaultParameter_Body()
+    {
+        /*
+        foo.bar.A.method1 = function(bar, bax) {
+            if (arguments.length < 2) {
+                if (arguments.length < 1) {
+                    bar = 42;
+                }
+                bax = 4;
+            }
+        }
+        */
+        IFunctionNode node = getMethod("function method1(bar:int = 42, bax:int = 4):void{if (a) foo();}");
+        asBlockWalker.visitFunction(node);
+        assertOut("A.prototype.method1 = function(bar, bax) {\n\tif (arguments.length < 2) {\n\t\t"
+                + "if (arguments.length < 1) {\n\t\t\tbar = 42;\n\t\t}\n\t\tbax = 4;\n\t}\n\t"
+                + "if (a)\n\t\tfoo();\n}");
+    }
+
+    @Ignore
+    @Test
+    public void testDefaultParameter_NoBody_Alternate()
+    {
+        /*
+        foo.bar.A.method1 = function(bar, bax) {
+            if (arguments.length < 2) {
+                if (arguments.length < 1) {
+                    bar = 42;
+                }
+                bax = 4;
+            }
+        }
+        */
+        IFunctionNode node = getMethod("function method1(bar:int = 42, bax:int = 4):void{\n}");
+        asBlockWalker.visitFunction(node);
+        assertOut("A.prototype.method1 = function(bar, bax) {\n\tif (arguments.length < 2) {\n\t\t"
+                + "if (arguments.length < 1) {\n\t\t\tbar = 42;\n\t\t}\n\t\tbax = 4;\n\t}\n}");
+    }
+
+    @Override
+    protected IBackend createBackend()
+    {
+        return new AMDBackend();
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDEmiter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceI.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceI.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceI.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceI.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,51 @@
+/*
+ *
+ *  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.amd;
+
+import org.apache.flex.compiler.internal.test.AMDTestBase;
+import org.junit.Test;
+
+/**
+ * This class tests the production of AMD JavaScript for the test project,
+ * interface I.
+ * 
+ * @author Michael Schmalle
+ */
+public class TestAMDInterfaceI extends AMDTestBase
+{
+    //--------------------------------------------------------------------------
+    // Interface I
+    //--------------------------------------------------------------------------
+
+    @Test
+    public void test_file()
+    {
+        asBlockWalker.visitFile(fileNode);
+        assertOut("define([\"exports\", \"runtime/AS3\"], function($exports, AS3) {"
+                + "\n\t\"use strict\"; \n\tAS3.interface_($exports, {\n\t\tpackage_: "
+                + "\"com.acme\",\n\t\tinterface_: \"I\"\n\t});\n});");
+    }
+
+    @Override
+    protected String getTypeUnderTest()
+    {
+        return "com.acme.I";
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceI.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceIOther.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceIOther.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceIOther.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceIOther.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,51 @@
+/*
+ *
+ *  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.amd;
+
+import org.apache.flex.compiler.internal.test.AMDTestBase;
+import org.junit.Test;
+
+/**
+ * This class tests the production of AMD JavaScript for the test project,
+ * interface com.acme.sub.IOther.
+ * 
+ * @author Michael Schmalle
+ */
+public class TestAMDInterfaceIOther extends AMDTestBase
+{
+    //--------------------------------------------------------------------------
+    // Interface IOther
+    //--------------------------------------------------------------------------
+
+    @Test
+    public void test_file()
+    {
+        asBlockWalker.visitFile(fileNode);
+        assertOut("define([\"exports\", \"runtime/AS3\"], function($exports, AS3) {"
+                + "\n\t\"use strict\"; \n\tAS3.interface_($exports, {\n\t\tpackage_: "
+                + "\"com.acme.sub\",\n\t\tinterface_: \"IOther\"\n\t});\n});");
+    }
+
+    @Override
+    protected String getTypeUnderTest()
+    {
+        return "com.acme.sub.IOther";
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceIOther.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceISub.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceISub.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceISub.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceISub.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,52 @@
+/*
+ *
+ *  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.amd;
+
+import org.apache.flex.compiler.internal.test.AMDTestBase;
+import org.junit.Test;
+
+/**
+ * This class tests the production of AMD JavaScript for the test project,
+ * interface com.acme.sub.ISub.
+ * 
+ * @author Michael Schmalle
+ */
+public class TestAMDInterfaceISub extends AMDTestBase
+{
+    //--------------------------------------------------------------------------
+    // Interface ISub
+    //--------------------------------------------------------------------------
+
+    @Test
+    public void test_file()
+    {
+        asBlockWalker.visitFile(fileNode);
+        assertOut("define([\"exports\", \"runtime/AS3\", \"classes/com/acme/I\"], "
+                + "function($exports, AS3, I) {\n\t\"use strict\"; \n\tAS3.interface_($exports, {"
+                + "\n\t\tpackage_: \"com.acme.sub\",\n\t\tinterface_: \"ISub\"\n\t\textends_: "
+                + "[\n\t\t\tI\n\t\t]\n\t});\n});");
+    }
+
+    @Override
+    protected String getTypeUnderTest()
+    {
+        return "com.acme.sub.ISub";
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDInterfaceISub.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDPackage.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDPackage.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDPackage.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDPackage.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,128 @@
+/*
+ *
+ *  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.amd;
+
+import java.io.IOException;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.as.TestPackage;
+import org.apache.flex.compiler.internal.driver.js.amd.AMDBackend;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This class tests the production of AMD JavaScript for AS package.
+ * 
+ * @author Michael Schmalle
+ */
+public class TestAMDPackage extends TestPackage
+{
+
+    @Override
+    @Test
+    public void testPackage_Simple()
+    {
+        IFileNode node = compileAS("package{}");
+        asBlockWalker.visitFile(node);
+        assertOut("");
+    }
+
+    @Override
+    @Test
+    public void testPackage_SimpleName()
+    {
+        IFileNode node = compileAS("package foo {}");
+        asBlockWalker.visitFile(node);
+        assertOut("");
+    }
+
+    @Override
+    @Test
+    public void testPackage_Name()
+    {
+        IFileNode node = compileAS("package foo.bar.baz {}");
+        asBlockWalker.visitFile(node);
+        assertOut("");
+    }
+
+    @Override
+    @Test
+    public void testPackageSimple_Class()
+    {
+        IFileNode node = compileAS("package {public class A{}}");
+        asBlockWalker.visitFile(node);
+        //assertOut("");
+    }
+
+    @Ignore
+    @Test
+    public void testPackageSimple_TestA() throws IOException
+    {
+    }
+
+    @Override
+    @Test
+    public void testPackageQualified_Class()
+    {
+        IFileNode node = compileAS("package foo.bar.baz {public class A{}}");
+        asBlockWalker.visitFile(node);
+        //assertOut("");
+    }
+
+    @Override
+    @Test
+    public void testPackageQualified_ClassBody()
+    {
+        IFileNode node = compileAS("package foo.bar.baz {public class A{public function A(){}}}");
+        asBlockWalker.visitFile(node);
+        //assertOut("");
+    }
+
+    @Override
+    @Test
+    public void testPackageQualified_ClassBodyMethodContents()
+    {
+        IFileNode node = compileAS("package foo.bar.baz {public class A{public function A(){if (a){for (var i:Object in obj){doit();}}}}}");
+        asBlockWalker.visitFile(node);
+        //assertOut("");
+    }
+
+    //@Test
+    public void testMethod()
+    {
+        IFunctionNode node = getMethod("function foo(){}");
+        asBlockWalker.visitFunction(node);
+        assertOut("A.prototype.foo = function() {\n}");
+    }
+
+    @Override
+    protected IBackend createBackend()
+    {
+        return new AMDBackend();
+    }
+
+    protected IFileNode getFile(String code)
+    {
+        IFileNode node = compileAS(code);
+        return node;
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/amd/TestAMDPackage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogAccessorMembers.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogAccessorMembers.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogAccessorMembers.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogAccessorMembers.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,141 @@
+/*
+ *
+ *  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.TestAccessorMembers;
+import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
+import org.apache.flex.compiler.tree.as.IGetterNode;
+import org.apache.flex.compiler.tree.as.ISetterNode;
+import org.junit.Test;
+
+/**
+ * This class tests the production of valid 'goog' JS code for Class Accessor
+ * members.
+ * 
+ * @author Michael Schmalle
+ * @author Erik de Bruin
+ */
+public class TestGoogAccessorMembers extends TestAccessorMembers
+{
+    @Override
+    @Test
+    public void testGetAccessor()
+    {
+        IGetterNode node = (IGetterNode) getAccessor("function get foo():int{}");
+        asBlockWalker.visitGetter(node);
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', "
+                + "\n\t{get:function() {\n\t}, configurable:true}\n)");
+    }
+
+    @Test
+    public void testGetAccessor_withBody()
+    {
+        IGetterNode node = (IGetterNode) getAccessor("function get foo():int{return -1;}");
+        asBlockWalker.visitGetter(node);
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', "
+                + "\n\t{get:function() {\n\t\tvar self = this;\n\t\treturn -1;\n\t}, configurable:true}\n)");
+    }
+
+    @Override
+    @Test
+    public void testGetAccessor_withNamespace()
+    {
+        IGetterNode node = (IGetterNode) getAccessor("public function get foo():int{return -1;}");
+        asBlockWalker.visitGetter(node);
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', "
+                + "\n\t{get:function() {\n\t\tvar self = this;\n\t\treturn -1;\n\t}, configurable:true}\n)");
+    }
+
+    @Override
+    @Test
+    public void testGetAccessor_withNamespaceOverride()
+    {
+        // TODO (erikdebruin) need to figure out how to handle calls to 
+        //                    'super' since the JS getter is actually an 
+        //                    anonymous function... goog.bind or goog.partial?
+        IGetterNode node = (IGetterNode) getAccessor("public override function get foo():int{super.foo(); return -1;}");
+        asBlockWalker.visitGetter(node);
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', \n\t{get:function() {\n\t\tvar self = this;\n\t\tgoog.base(this, 'foo');\n\t\treturn -1;\n\t}, configurable:true}\n)");
+    }
+
+    @Override
+    @Test
+    public void testGetAccessor_withStatic()
+    {
+        IGetterNode node = (IGetterNode) getAccessor("public static function get foo():int{return -1;}");
+        asBlockWalker.visitGetter(node);
+        assertOut("Object.defineProperty(\n\tA, \n\t'foo', \n\t{get:function() {\n\t\tvar self = this;\n\t\treturn -1;\n\t}, configurable:true}\n)");
+    }
+
+    @Override
+    @Test
+    public void testSetAccessor()
+    {
+        ISetterNode node = (ISetterNode) getAccessor("function set foo(value:int):void{}");
+        asBlockWalker.visitSetter(node);
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', \n\t{set:function(value)"
+                + " {\n\t}, configurable:true}\n)");
+    }
+
+    @Test
+    public void testSetAccessor_withBody()
+    {
+        ISetterNode node = (ISetterNode) getAccessor("function set foo(value:int):void{trace('haai');}");
+        asBlockWalker.visitSetter(node);
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', "
+                + "\n\t{set:function(value) {\n\t\tvar self = this;\n\t\ttrace('haai');\n\t}, configurable:true}\n)");
+    }
+
+    @Override
+    @Test
+    public void testSetAccessor_withNamespace()
+    {
+        ISetterNode node = (ISetterNode) getAccessor("public function set foo(value:int):void{}");
+        asBlockWalker.visitSetter(node);
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', \n\t{set:function(value)"
+                + " {\n\t}, configurable:true}\n)");
+    }
+
+    @Override
+    @Test
+    public void testSetAccessor_withNamespaceOverride()
+    {
+        // TODO (erikdebruin) see: testGetAccessor_withNamespaceOverride
+        ISetterNode node = (ISetterNode) getAccessor("public override function set foo(value:int):void{super.foo();}");
+        asBlockWalker.visitSetter(node);
+        assertOut("Object.defineProperty(\n\tA.prototype, \n\t'foo', \n\t{set:function(value) {\n\t\tvar self = this;\n\t\tgoog.base(this, 'foo');\n\t}, configurable:true}\n)");
+    }
+
+    @Override
+    @Test
+    public void testSetAccessor_withStatic()
+    {
+        ISetterNode node = (ISetterNode) getAccessor("public static function set foo(value:int):void{}");
+        asBlockWalker.visitSetter(node);
+        assertOut("Object.defineProperty(\n\tA, \n\t'foo', \n\t{set:function(value) {\n\t}, configurable:true}\n)");
+    }
+
+    @Override
+    protected IBackend createBackend()
+    {
+        return new GoogBackend();
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogAccessorMembers.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogClass.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogClass.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogClass.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogClass.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,244 @@
+/*
+ *
+ *  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.TestClass;
+import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
+import org.apache.flex.compiler.tree.as.IClassNode;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.junit.Test;
+
+/**
+ * This class tests the production of 'goog' JS code for Classes.
+ * 
+ * @author Michael Schmalle
+ * @author Erik de Bruin
+ */
+public class TestGoogClass extends TestClass
+{
+    @Override
+    @Test
+    public void testSimple()
+    {
+        IClassNode node = getClassNode("public class A{}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};");
+    }
+
+    @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() {\n};");
+    }
+
+    @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() {\n};");
+    }
+
+    @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() {\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\tgoog.base(this);\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() {\n};");
+    }
+
+    @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() {\n};");
+    }
+
+    @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\tgoog.base(this);\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\tgoog.base(this);\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\tgoog.base(this);\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\tgoog.base(this);\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+    }
+
+    @Override
+    @Test
+    public void testConstructor()
+    {
+        IClassNode node = getClassNode("public class A {public function A() {super('foo', 42);}}");
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n\tvar self = this;\n\tgoog.base(this, 'foo', 42);\n};");
+    }
+
+    @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) {\n};");
+    }
+
+    @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\tgoog.base(this, 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 * @protected\n * @type {string}\n */\norg.apache.flex.A.prototype.b;\n\n/**\n * @private\n * @type {number}\n */\norg.apache.flex.A.prototype.c;\n\n/**\n * @type {number}\n */\norg.apache.flex.A.prototype.d;\n\n/**\n * @type {number}\n */\norg.apache.flex.A.prototype.e;");
+    }
+
+    @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};\n\n/**\n * @const\n * @type {number}\n */\norg.apache.flex.A.A = 42;\n\n/**\n * @protected\n * @const\n * @type {number}\n */\norg.apache.flex.A.B = 42;\n\n/**\n * @private\n * @const\n * @type {number}\n */\norg.apache.flex.A.C = 42;\n\n/**\n * @const\n * @type {string}\n */\norg.apache.flex.A.C = 'me' + 'you';");
+    }
+
+    @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 * @type {Object}\n */\norg.apache.flex.A.prototype.foo1;\n\nObject.defineProperty(\n\torg.apache.flex.A.prototype, \n\t'foo1', \n\t{get:function() {\n\t\tvar self = this;\n\t\treturn null;\n\t}, configurable:true}\n);\n\nObject.defineProperty(\n\torg.apache.flex.A.prototype, \n\t'foo1', \n\t{set:function(value) {\n\t}, configurable:true}\n);\n\n/**\n * @protected\n * @type {Object}\n */\norg.apache.flex.A.prototype.foo2;\n\nObject.defineProperty(\n\torg.apache.flex.A.prototype, \n\t'foo2', \n\t{get:function() {\n\t\tvar self = this;\n\t\treturn null;\n\t}, configurable:true}\n);\n\nObject.defineProperty(\n\torg.apache.flex.A.prototype, \n\t'foo2', \n\t{set:function(value) {\n\t}, configurable:true}\n);\n\n/**\n * @private\n * @type {Object}\n */\norg.apache.flex.A.prototype.foo3;\n\nObject.defineProperty(\n\torg.apache.flex.A.prototype, \n\t'foo3', \n\t{get:function() {\n\t\tvar self 
 = this;\n\t\treturn null;\n\t}, configurable:true}\n);\n\nObject.defineProperty(\n\torg.apache.flex.A.prototype, \n\t'foo3', \n\t{set:function(value) {\n\t}, configurable:true}\n);\n\n/**\n * @type {Object}\n */\norg.apache.flex.A.prototype.foo5;\n\nObject.defineProperty(\n\torg.apache.flex.A.prototype, \n\t'foo5', \n\t{get:function() {\n\t\tvar self = this;\n\t\treturn null;\n\t}, configurable:true}\n);\n\nObject.defineProperty(\n\torg.apache.flex.A.prototype, \n\t'foo5', \n\t{set:function(value) {\n\t}, configurable:true}\n);\n\n/**\n * @type {Object}\n */\norg.apache.flex.A.prototype.foo6;\n\nObject.defineProperty(\n\torg.apache.flex.A.prototype, \n\t'foo6', \n\t{get:function() {\n\t\tvar self = this;\n\t\treturn null;\n\t}, configurable:true}\n);\n\nObject.defineProperty(\n\torg.apache.flex.A.prototype, \n\t'foo6', \n\t{set:function(value) {\n\t}, configurable:true}\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 * @return {Object}\n */\norg.apache.flex.A.prototype.foo1 = function() {\n\tvar self = this;\n\treturn null;\n};\n\n/**\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1a = function() {\n\tvar self = this;\n\treturn null;\n};\n\n/**\n * @return {Object}\n * @override\n */\norg.apache.flex.A.prototype.foo1b = function() {\n\tvar self = this;\n\treturn goog.base(this, 'foo1b');\n};\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo2 = function(value) {\n};\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo3 = function(value) {\n};\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo5 = function(value) {\n};\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo6 = function(value) {\n};\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.foo7 = function(value) {\n};\n\n/**\n * @param {Object} value\n
  */\norg.apache.flex.A.foo7 = function(value) {\n};");
+    }
+
+    @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 GoogBackend();
+    }
+
+}

Propchange: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogClass.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message