flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erikdebr...@apache.org
Subject svn commit: r1452890 - in /flex/falcon/trunk: compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/ compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/ compiler.jx.tests/src/org/apache/flex/compiler/internal/tes...
Date Tue, 05 Mar 2013 16:46:45 GMT
Author: erikdebruin
Date: Tue Mar  5 16:46:44 2013
New Revision: 1452890

URL: http://svn.apache.org/r1452890
Log:
General: gave MXMLBlockWalker the initial ability to output 'embedded' AS using the actual AS Walkers/Visitors/Emitters.

- created new "base" type for BlockWalkers and BlockVisitors, so methods can pass both AS and MXML versions around
- refactored existing BlockWalkers and BlockVisitors to implement these types
- MXMLBlockWalker now gets passed an ASEmitter and ASBlockWalker instance, which provide the actual AS parsing
- wrote some new MXML/FlexJS tests and made them pass with above modifications

Added:
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockVisitor.java   (with props)
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockWalker.java   (with props)
Modified:
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLScript.java
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/TestFlexJSMXMLApplication.java
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/MXMLTestBase.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/as/codegen/IASEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/driver/IBackend.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitterTokens.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/driver/ASBackend.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/visitor/ASNodeSwitch.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLBlockWalker.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSBlockWalker.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/MXMLBackend.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/flexjs/MXMLFlexJSBackend.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/MXMLNodeSwitch.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/IMXMLEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockVisitor.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockWalker.java

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLScript.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLScript.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLScript.java (original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLScript.java Tue Mar  5 16:46:44 2013
@@ -11,27 +11,39 @@ public class TestMXMLScript extends MXML
     @Test
     public void testEmptyScript()
     {
-        String code = ""
-                + "<fx:Script><![CDATA[]]></fx:Script>";
+        String code = "" + "<fx:Script><![CDATA[]]></fx:Script>";
 
         IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
                 IMXMLScriptNode.class, MXMLTestBase.WRAP_LEVEL_DOCUMENT);
 
         mxmlBlockWalker.visitScript(node);
 
-        assertOut("");
+        assertOut("<script><![CDATA[]]></script>");
     }
 
-    @Ignore
     @Test
     public void testSimpleScript()
     {
-        // TODO (erikdebruin) handle actual script contents... 
-        //                    maybe use AS emitter?
-        
         String code = ""
                 + "<fx:Script><![CDATA["
-                + "    private const GREETING:String = \"Hello world!\""
+                + "    private const GREETING:String = \"Hello world!\";"
+                + "]]></fx:Script>";
+
+        IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
+                IMXMLScriptNode.class, MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+
+        mxmlBlockWalker.visitScript(node);
+
+        assertOut("<script><![CDATA[\n\tprivate const GREETING:String = \"Hello world!\";\n]]></script>");
+    }
+
+    @Test
+    public void testMultiLineScript()
+    {
+        String code = ""
+                + "<fx:Script><![CDATA["
+                + "    public var goodbye:String = \"Bye bye :-(\";"
+                + "    private const GREETING:String = \"Hello world!\";"
                 + "]]></fx:Script>";
 
         IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
@@ -39,7 +51,45 @@ public class TestMXMLScript extends MXML
 
         mxmlBlockWalker.visitScript(node);
 
-        assertOut("");
+        assertOut("<script><![CDATA[\n\tpublic var goodbye:String = \"Bye bye :-(\";\n\tprivate const GREETING:String = \"Hello world!\";\n]]></script>");
+    }
+
+    @Test
+    public void testComplexScript()
+    {
+        // TODO (erikdebruin) fix indentation...
+        String code = ""
+                + "<fx:Script><![CDATA[" + "    var n:int = 3;"
+                + "    for (var i:int = 0; i < n; i++)" + "    {"
+                + "        Alert.show(\"Hi\");" + "    }" + "]]></fx:Script>";
+
+        IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
+                IMXMLScriptNode.class, MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+
+        mxmlBlockWalker.visitScript(node);
+
+        assertOut("<script><![CDATA[\n\tvar n:int = 3;\n\tfor (var i:int = 0; i < n; i++) {\n\tAlert.show(\"Hi\");\n};\n]]></script>");
+    }
+
+    @Ignore
+    @Test
+    public void testFunctionScript()
+    {
+        // TODO (erikdebruin) this isn't working...
+        String code = ""
+                + "<fx:Script><![CDATA["
+                + "    public static function beNice(input:*):Object" + "    {"
+                + "        Alert.show(\"I'm nice :-P\");"
+                + "        return null;" + "    }" + "]]></fx:Script>";
+
+        IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
+                IMXMLScriptNode.class, MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+
+        mxmlBlockWalker.visitScript(node);
+
+        System.out.println(writer.toString());
+
+        assertOut("<script><![CDATA[\n\tvar n:int = 3;\n\tfor (var i:int = 0; i < n; i++) {\n\tAlert.show(\"Hi\");\n};\n]]></script>");
     }
 
 }

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/TestFlexJSMXMLApplication.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/TestFlexJSMXMLApplication.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/TestFlexJSMXMLApplication.java (original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/TestFlexJSMXMLApplication.java Tue Mar  5 16:46:44 2013
@@ -8,21 +8,6 @@ import org.junit.Test;
 public class TestFlexJSMXMLApplication extends FlexJSTestBase
 {
 
-    /*
-    <basic:beads>
-        <basic:HTTPService id="service">
-            <basic:LazyCollection id="collection">
-                <basic:inputParser>
-                    <basic:JSONInputParser />
-                </basic:inputParser>
-                <basic:itemConverter>
-                    <local:StockDataJSONItemConverter />
-                </basic:itemConverter> 
-            </basic:LazyCollection>
-        </basic:HTTPService>
-    </basic:beads>
-    //*/
-
     // TODO (erikdebruin) this needs to become JS Goog output ;-)
 
     @Test
@@ -40,12 +25,26 @@ public class TestFlexJSMXMLApplication e
     }
 
     @Test
+    public void testFlexJSAppWithEvent()
+    {
+        String code = ""
+                + "<basic:Application xmlns:basic=\"library://ns.apache.org/flexjs/basic\""
+                + "                   initialize=\"MyModel(model).labelText='Hello World'\">"
+                + "</basic:Application>";
+
+        IMXMLFileNode node = compileMXML(code);
+
+        mxmlBlockWalker.visitFile(node);
+
+        assertOut("<Application initialize=\"MyModel(model).labelText = 'Hello World'\">\n</Application>");
+    }
+
+    @Test
     public void testFlexJSAppWithNode()
     {
         String code = ""
                 + "<basic:Application xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
-                + "    <basic:beads />" 
-                + "</basic:Application>";
+                + "    <basic:beads />" + "</basic:Application>";
 
         IMXMLFileNode node = compileMXML(code);
 
@@ -71,16 +70,13 @@ public class TestFlexJSMXMLApplication e
                 + "                    <local:StockDataJSONItemConverter />"
                 + "                </basic:itemConverter>"
                 + "            </basic:LazyCollection id=\"collection\">"
-                + "        </basic:HTTPService>" 
-                + "    </basic:beads>"
+                + "        </basic:HTTPService>" + "    </basic:beads>"
                 + "</basic:Application>";
 
         IMXMLFileNode node = compileMXML(code);
 
         mxmlBlockWalker.visitFile(node);
 
-        //System.out.println(writer.toString());
-        
         assertOut("<Application>\n\t<beads>\n\t\t<HTTPService id=\"service\">\n\t\t\t<beads>\n\t\t\t\t<LazyCollection id=\"collection\">\n\t\t\t\t\t<inputParser>\n\t\t\t\t\t\t<JSONInputParser>\n\t\t\t\t\t\t</JSONInputParser>\n\t\t\t\t\t</inputParser>\n\t\t\t\t\t<itemConverter>\n\t\t\t\t\t\t<StockDataJSONItemConverter>\n\t\t\t\t\t\t</StockDataJSONItemConverter>\n\t\t\t\t\t</itemConverter>\n\t\t\t\t</LazyCollection>\n\t\t\t</beads>\n\t\t</HTTPService>\n\t</beads>\n</Application>");
     }
 
@@ -94,7 +90,7 @@ public class TestFlexJSMXMLApplication e
         mxmlBlockWalker.visitFile(node);
 
         //System.out.println(writer.toString());
-        
+
         assertOut("");
     }
 }

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java (original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java Tue Mar  5 16:46:44 2013
@@ -21,9 +21,12 @@ public class FlexJSTestBase extends Test
     {
         super.setUp();
 
+        asEmitter = backend.createEmitter(writer);
         mxmlEmitter = backend.createMXMLEmitter(writer);
-        mxmlBlockWalker = backend
-                .createMXMLWalker(project, errors, mxmlEmitter);
+
+        asBlockWalker = backend.createWalker(project, errors, asEmitter);
+        mxmlBlockWalker = backend.createMXMLWalker(project, errors,
+                mxmlEmitter, asEmitter, asBlockWalker);
     }
 
     @Override
@@ -45,8 +48,8 @@ public class FlexJSTestBase extends Test
     {
         namespaceMappings
                 .add(new MXMLNamespaceMapping(
-                        "library://ns.apache.org/flexjs/basic",
-                        new File(asjsRoot + "frameworks/as/basic-manifest.xml")
+                        "library://ns.apache.org/flexjs/basic", new File(
+                                asjsRoot + "frameworks/as/basic-manifest.xml")
                                 .getAbsolutePath()));
 
         super.addNamespaceMappings();

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/MXMLTestBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/MXMLTestBase.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/MXMLTestBase.java (original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/MXMLTestBase.java Tue Mar  5 16:46:44 2013
@@ -20,9 +20,12 @@ public class MXMLTestBase extends TestBa
     {
         super.setUp();
 
+        asEmitter = backend.createEmitter(writer);
         mxmlEmitter = backend.createMXMLEmitter(writer);
-        mxmlBlockWalker = backend
-                .createMXMLWalker(project, errors, mxmlEmitter);
+
+        asBlockWalker = backend.createWalker(project, errors, asEmitter);
+        mxmlBlockWalker = backend.createMXMLWalker(project, errors,
+                mxmlEmitter, asEmitter, asBlockWalker);
     }
 
     @Override
@@ -80,8 +83,8 @@ public class MXMLTestBase extends TestBa
             code = ""
                     + "<s:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\""
                     + " xmlns:s=\"library://ns.adobe.com/flex/spark\""
-                    + " xmlns:mx=\"library://ns.adobe.com/flex/mx\">"
-                    + code + "</s:Application>";
+                    + " xmlns:mx=\"library://ns.adobe.com/flex/mx\">" + code
+                    + "</s:Application>";
 
         IMXMLFileNode node = compileMXML(code);
 

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/as/codegen/IASEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/as/codegen/IASEmitter.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/as/codegen/IASEmitter.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/as/codegen/IASEmitter.java Tue Mar  5 16:46:44 2013
@@ -64,7 +64,7 @@ import org.apache.flex.compiler.tree.as.
 import org.apache.flex.compiler.tree.as.IWhileLoopNode;
 import org.apache.flex.compiler.tree.as.IWithNode;
 import org.apache.flex.compiler.tree.metadata.IMetaTagNode;
-import org.apache.flex.compiler.visitor.IASBlockWalker;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 import org.apache.flex.compiler.visitor.IASNodeStrategy;
 
 /**
@@ -75,9 +75,9 @@ import org.apache.flex.compiler.visitor.
  */
 public interface IASEmitter extends IEmitter
 {
-    IASBlockWalker getWalker();
+    IBlockWalker getWalker();
 
-    void setWalker(IASBlockWalker asBlockWalker);
+    void setWalker(IBlockWalker asBlockWalker);
 
     IDocEmitter getDocEmitter();
 

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/driver/IBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/driver/IBackend.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/driver/IBackend.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/driver/IBackend.java Tue Mar  5 16:46:44 2013
@@ -40,6 +40,7 @@ import org.apache.flex.compiler.targets.
 import org.apache.flex.compiler.targets.ITargetSettings;
 import org.apache.flex.compiler.units.ICompilationUnit;
 import org.apache.flex.compiler.visitor.IASBlockWalker;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 import org.apache.flex.compiler.visitor.IMXMLBlockWalker;
 
 /**
@@ -109,6 +110,7 @@ public interface IBackend
      * emitter and is available for callbacks to it's visit methods.
      */
     IMXMLBlockWalker createMXMLWalker(IASProject project,
-            List<ICompilerProblem> errors, IMXMLEmitter emitter);
+            List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+            IASEmitter asEmitter, IBlockWalker asBlockWalker);
 
 }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java Tue Mar  5 16:46:44 2013
@@ -92,6 +92,7 @@ import org.apache.flex.compiler.tree.as.
 import org.apache.flex.compiler.tree.as.IWithNode;
 import org.apache.flex.compiler.tree.metadata.IMetaTagNode;
 import org.apache.flex.compiler.visitor.IASBlockWalker;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 
 /**
  * The base implementation for an ActionScript emitter.
@@ -147,15 +148,15 @@ public class ASEmitter implements IASEmi
     private IASBlockWalker walker;
 
     @Override
-    public IASBlockWalker getWalker()
+    public IBlockWalker getWalker()
     {
-        return walker;
+        return (IBlockWalker) walker;
     }
 
     @Override
-    public void setWalker(IASBlockWalker value)
+    public void setWalker(IBlockWalker value)
     {
-        walker = value;
+        walker = (IASBlockWalker) value;
     }
 
     @Override

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitterTokens.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitterTokens.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitterTokens.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitterTokens.java Tue Mar  5 16:46:44 2013
@@ -27,7 +27,8 @@ import org.apache.flex.compiler.common.c
  */
 public enum ASEmitterTokens implements IEmitterTokens
 {
-    INDENT("\t"), NEW_LINE("\n"), SINGLE_QUOTE("'"), SPACE(" "),
+    DOUBLE_QUOTE("\""), INDENT("\t"), NEW_LINE("\n"), SINGLE_QUOTE("'"), SPACE(
+            " "),
 
     INTERNAL("internal"), PRIVATE("private"), PROTECTED("protected"),
 

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/driver/ASBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/driver/ASBackend.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/driver/ASBackend.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/driver/ASBackend.java Tue Mar  5 16:46:44 2013
@@ -47,6 +47,7 @@ import org.apache.flex.compiler.targets.
 import org.apache.flex.compiler.tree.as.IFileNode;
 import org.apache.flex.compiler.units.ICompilationUnit;
 import org.apache.flex.compiler.visitor.IASBlockWalker;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 import org.apache.flex.compiler.visitor.IMXMLBlockWalker;
 
 /**
@@ -99,7 +100,8 @@ public class ASBackend implements IBacke
 
     @Override
     public IMXMLBlockWalker createMXMLWalker(IASProject project,
-            List<ICompilerProblem> errors, IMXMLEmitter emitter)
+            List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+            IASEmitter asEmitter, IBlockWalker asBlockWalker)
     {
         return null;
     }
@@ -117,7 +119,7 @@ public class ASBackend implements IBacke
     {
         return new ASEmitter(writer);
     }
-    
+
     @Override
     public IMXMLEmitter createMXMLEmitter(FilterWriter writer)
     {

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/visitor/ASNodeSwitch.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/visitor/ASNodeSwitch.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/visitor/ASNodeSwitch.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/visitor/ASNodeSwitch.java Tue Mar  5 16:46:44 2013
@@ -67,6 +67,7 @@ import org.apache.flex.compiler.tree.as.
 import org.apache.flex.compiler.tree.metadata.IMetaTagNode;
 import org.apache.flex.compiler.tree.metadata.IMetaTagsNode;
 import org.apache.flex.compiler.visitor.IASBlockVisitor;
+import org.apache.flex.compiler.visitor.IBlockVisitor;
 import org.apache.flex.compiler.visitor.IASNodeStrategy;
 
 /**
@@ -89,9 +90,9 @@ public class ASNodeSwitch implements IAS
      * @param visitor The {@link IASBlockVisitor} strategy that will visit an
      * {@link IASNode} based on it's type.
      */
-    public ASNodeSwitch(IASBlockVisitor visitor)
+    public ASNodeSwitch(IBlockVisitor visitor)
     {
-        this.visitor = visitor;
+        this.visitor = (IASBlockVisitor) visitor;
     }
 
     @Override

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java Tue Mar  5 16:46:44 2013
@@ -49,6 +49,7 @@ import org.apache.flex.compiler.targets.
 import org.apache.flex.compiler.tree.as.IFileNode;
 import org.apache.flex.compiler.units.ICompilationUnit;
 import org.apache.flex.compiler.visitor.IASBlockWalker;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 import org.apache.flex.compiler.visitor.IMXMLBlockWalker;
 
 /**
@@ -102,7 +103,8 @@ public class JSBackend implements IBacke
 
     @Override
     public IMXMLBlockWalker createMXMLWalker(IASProject project,
-            List<ICompilerProblem> errors, IMXMLEmitter emitter)
+            List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+            IASEmitter asEmitter, IBlockWalker asBlockWalker)
     {
         return null;
     }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLBlockWalker.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLBlockWalker.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLBlockWalker.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLBlockWalker.java Tue Mar  5 16:46:44 2013
@@ -21,6 +21,7 @@ package org.apache.flex.compiler.interna
 
 import java.util.List;
 
+import org.apache.flex.compiler.as.codegen.IASEmitter;
 import org.apache.flex.compiler.mxml.codegen.IMXMLEmitter;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.IASProject;
@@ -36,15 +37,17 @@ import org.apache.flex.compiler.tree.mxm
 import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLIntNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLNumberNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLStyleSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLUintNode;
-import org.apache.flex.compiler.visitor.IASNodeStrategy;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 import org.apache.flex.compiler.visitor.IMXMLBlockVisitor;
 import org.apache.flex.compiler.visitor.IMXMLBlockWalker;
+import org.apache.flex.compiler.visitor.IASNodeStrategy;
 
 /**
  * @author Michael Schmalle
@@ -52,9 +55,37 @@ import org.apache.flex.compiler.visitor.
  */
 public class MXMLBlockWalker implements IMXMLBlockVisitor, IMXMLBlockWalker
 {
+
+    //----------------------------------
+    // emitter
+    //----------------------------------
+
+    private IASEmitter asEmitter;
+
+    @Override
+    public IASEmitter getASEmitter()
+    {
+        return asEmitter;
+    }
+
+    private IMXMLEmitter mxmlEmitter;
+
+    @Override
+    public IMXMLEmitter getMXMLEmitter()
+    {
+        return mxmlEmitter;
+    }
+
+    //----------------------------------
+    // errors
+    //----------------------------------
+
     private List<ICompilerProblem> errors;
 
-    protected IMXMLEmitter emitter;
+    List<ICompilerProblem> getErrors()
+    {
+        return errors;
+    }
 
     //----------------------------------
     // project
@@ -71,36 +102,55 @@ public class MXMLBlockWalker implements 
     // strategy
     //----------------------------------
 
-    private IASNodeStrategy strategy;
+    private IASNodeStrategy mxmlStrategy;
 
-    public IASNodeStrategy getStrategy()
+    public IASNodeStrategy getMXMLStrategy()
     {
-        return strategy;
+        return mxmlStrategy;
     }
 
-    public void setStrategy(IASNodeStrategy value)
+    public void setMXMLStrategy(IASNodeStrategy value)
     {
-        strategy = value;
+        mxmlStrategy = value;
     }
 
-    List<ICompilerProblem> getErrors()
+    private IASNodeStrategy asStrategy;
+
+    public IASNodeStrategy getASStrategy()
     {
-        return errors;
+        return asStrategy;
     }
 
+    public void setASStrategy(IASNodeStrategy value)
+    {
+        asStrategy = value;
+    }
+
+    //----------------------------------
+    // walk
+    //----------------------------------
+
     @Override
     public void walk(IASNode node)
     {
-        strategy.handle(node);
+        if (node instanceof IMXMLNode)
+            mxmlStrategy.handle(node);
+        else
+            asStrategy.handle(node);
     }
 
     public MXMLBlockWalker(List<ICompilerProblem> errors, IASProject project,
-            IMXMLEmitter emitter)
+            IMXMLEmitter mxmlEmitter, IASEmitter asEmitter,
+            IBlockWalker asBlockWalker)
     {
-        this.emitter = emitter;
+        this.asEmitter = asEmitter;
+        this.mxmlEmitter = mxmlEmitter;
         this.project = project;
         this.errors = errors;
-        emitter.setMXMLWalker(this);
+
+        asEmitter.setWalker(asBlockWalker);
+
+        mxmlEmitter.setMXMLWalker((IBlockWalker) this);
     }
 
     @Override
@@ -124,9 +174,9 @@ public class MXMLBlockWalker implements 
     {
         debug("visitDocument()");
 
-        emitter.emitDocumentHeader(node);
+        mxmlEmitter.emitDocumentHeader(node);
         visitClassDefinition(node);
-        emitter.emitDocumentFooter(node);
+        mxmlEmitter.emitDocumentFooter(node);
     }
 
     @Override
@@ -134,7 +184,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitClassDefinition()");
 
-        emitter.emitClass(node);
+        mxmlEmitter.emitClass(node);
     }
 
     //--------------------------------------------------------------------------
@@ -153,6 +203,8 @@ public class MXMLBlockWalker implements 
     public void visitEventSpecifier(IMXMLEventSpecifierNode node)
     {
         debug("visitEventSpecifier()");
+
+        mxmlEmitter.emitEventSpecifier(node);
     }
 
     @Override
@@ -160,7 +212,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitInstance()");
 
-        emitter.emitInstance(node);
+        mxmlEmitter.emitInstance(node);
     }
 
     @Override
@@ -168,7 +220,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitPropertySpecifier()");
 
-        emitter.emitPropertySpecifier(node);
+        mxmlEmitter.emitPropertySpecifier(node);
     }
 
     @Override
@@ -176,7 +228,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitScript()");
 
-        emitter.emitScript(node);
+        mxmlEmitter.emitScript(node);
     }
 
     @Override
@@ -184,7 +236,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitStyleSpecifier()");
 
-        emitter.emitStyleSpecifier(node);
+        mxmlEmitter.emitStyleSpecifier(node);
     }
 
     //--------------------------------------------------------------------------
@@ -194,7 +246,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitArray()");
 
-        emitter.emitArray(node);
+        mxmlEmitter.emitArray(node);
     }
 
     @Override
@@ -202,7 +254,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitBoolean()");
 
-        emitter.emitBoolean(node);
+        mxmlEmitter.emitBoolean(node);
     }
 
     @Override
@@ -210,7 +262,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitInt()");
 
-        emitter.emitInt(node);
+        mxmlEmitter.emitInt(node);
     }
 
     @Override
@@ -218,7 +270,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitNumber()");
 
-        emitter.emitNumber(node);
+        mxmlEmitter.emitNumber(node);
     }
 
     @Override
@@ -226,7 +278,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitString()");
 
-        emitter.emitString(node);
+        mxmlEmitter.emitString(node);
     }
 
     @Override
@@ -234,7 +286,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitUint()");
 
-        emitter.emitUint(node);
+        mxmlEmitter.emitUint(node);
     }
 
     //--------------------------------------------------------------------------
@@ -244,7 +296,7 @@ public class MXMLBlockWalker implements 
     {
         debug("visitLiteral()");
 
-        emitter.emitLiteral(node);
+        mxmlEmitter.emitLiteral(node);
     }
 
     //--------------------------------------------------------------------------

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitter.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitter.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/MXMLEmitter.java Tue Mar  5 16:46:44 2013
@@ -32,6 +32,7 @@ import org.apache.flex.compiler.tree.mxm
 import org.apache.flex.compiler.tree.mxml.IMXMLClassDefinitionNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDeclarationsNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLIntNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
@@ -42,6 +43,8 @@ import org.apache.flex.compiler.tree.mxm
 import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLStyleSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLUintNode;
+import org.apache.flex.compiler.visitor.IBlockWalker;
+import org.apache.flex.compiler.visitor.IMXMLBlockWalker;
 
 /**
  * The base implementation for an MXML emitter.
@@ -51,18 +54,22 @@ import org.apache.flex.compiler.tree.mxm
 public class MXMLEmitter extends Emitter implements IMXMLEmitter
 {
 
-    protected MXMLBlockWalker walker;
+    //--------------------------------------------------------------------------
+    //    walkers
+    //--------------------------------------------------------------------------
+
+    protected IMXMLBlockWalker walker;
 
     @Override
-    public MXMLBlockWalker getMXMLWalker()
+    public IBlockWalker getMXMLWalker()
     {
-        return walker;
+        return (IBlockWalker) walker;
     }
 
     @Override
-    public void setMXMLWalker(MXMLBlockWalker value)
+    public void setMXMLWalker(IBlockWalker value)
     {
-        walker = value;
+        walker = (IMXMLBlockWalker) value;
     }
 
     public MXMLEmitter(FilterWriter out)
@@ -128,6 +135,11 @@ public class MXMLEmitter extends Emitter
     //--------------------------------------------------------------------------
 
     @Override
+    public void emitEventSpecifier(IMXMLEventSpecifierNode node)
+    {
+    }
+
+    @Override
     public void emitInstance(IMXMLInstanceNode node)
     {
         IClassDefinition cdef = node
@@ -191,7 +203,25 @@ public class MXMLEmitter extends Emitter
     @Override
     public void emitScript(IMXMLScriptNode node)
     {
-        // TODO (erikdebruin) handle AS script parsing...
+        write("<script><![CDATA[");
+
+        int len = node.getChildCount();
+        if (len > 0)
+        {
+            writeNewline("", true);
+
+            for (int i = 0; i < len; i++)
+            {
+                getMXMLWalker().walk(node.getChild(i));
+
+                if (i == len - 1)
+                    indentPop();
+
+                writeNewline(ASEmitterTokens.SEMICOLON);
+            }
+        }
+
+        write("]]></script>");
     }
 
     //--------------------------------------------------------------------------
@@ -228,13 +258,13 @@ public class MXMLEmitter extends Emitter
     {
         emitAttributeValue(node);
     }
-    
+
     @Override
     public void emitString(IMXMLStringNode node)
     {
         emitAttributeValue(node);
     }
-    
+
     @Override
     public void emitUint(IMXMLUintNode node)
     {
@@ -276,13 +306,13 @@ public class MXMLEmitter extends Emitter
     protected void emitAttributeValue(IASNode node)
     {
         IMXMLLiteralNode cnode = (IMXMLLiteralNode) node.getChild(0);
-        
+
         if (cnode.getValue() != null)
         {
             write("\"");
-    
+
             getMXMLWalker().walk((IASNode) cnode); // Literal
-    
+
             write("\"");
         }
     }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSBlockWalker.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSBlockWalker.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSBlockWalker.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSBlockWalker.java Tue Mar  5 16:46:44 2013
@@ -21,11 +21,15 @@ package org.apache.flex.compiler.interna
 
 import java.util.List;
 
+import org.apache.flex.compiler.as.codegen.IASEmitter;
 import org.apache.flex.compiler.internal.mxml.codegen.MXMLBlockWalker;
 import org.apache.flex.compiler.mxml.codegen.IMXMLEmitter;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.IASProject;
+import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 
 /**
  * @author Michael Schmalle
@@ -34,10 +38,15 @@ import org.apache.flex.compiler.tree.mxm
 public class MXMLFlexJSBlockWalker extends MXMLBlockWalker
 {
 
-    public MXMLFlexJSBlockWalker(List<ICompilerProblem> errors, IASProject project,
-            IMXMLEmitter emitter)
+    private IMXMLEmitter mxmlEmitter;
+
+    public MXMLFlexJSBlockWalker(List<ICompilerProblem> errors,
+            IASProject project, IMXMLEmitter mxmlEmitter, IASEmitter asEmitter,
+            IBlockWalker asBlockWalker)
     {
-        super(errors, project, emitter);
+        super(errors, project, mxmlEmitter, asEmitter, asBlockWalker);
+
+        this.mxmlEmitter = mxmlEmitter;
     }
 
     //--------------------------------------------------------------------------
@@ -47,11 +56,18 @@ public class MXMLFlexJSBlockWalker exten
     {
         debug("visitDocument()");
 
-        emitter.emitDocumentHeader(node);
-        
-        emitter.emitPropertySpecifiers(node.getPropertySpecifierNodes(), true);
+        mxmlEmitter.emitDocumentHeader(node);
+
+        final int len = node.getChildCount();
+        for (int i = 0; i < len; i++)
+        {
+            IASNode cnode = node.getChild(i);
+
+            if (!(cnode instanceof IMXMLEventSpecifierNode))
+                walk(cnode); // first level children
+        }
 
-        emitter.emitDocumentFooter(node);
+        mxmlEmitter.emitDocumentFooter(node);
     }
 
 }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSEmitter.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSEmitter.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSEmitter.java Tue Mar  5 16:46:44 2013
@@ -22,13 +22,14 @@ package org.apache.flex.compiler.interna
 import java.io.FilterWriter;
 
 import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.internal.as.codegen.ASEmitterTokens;
 import org.apache.flex.compiler.internal.mxml.codegen.MXMLEmitter;
 import org.apache.flex.compiler.mxml.codegen.flexjs.IMXMLFlexJSEmitter;
 import org.apache.flex.compiler.projects.ICompilerProject;
-import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLArrayNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
 
@@ -54,18 +55,53 @@ public class MXMLFlexJSEmitter extends M
         IClassDefinition cdef = node
                 .getClassReference((ICompilerProject) walker.getProject());
 
-        write("<" + cdef.getBaseName() + ">");
+        System.out.println("Emit Document Header: "
+                + cdef.getBaseName() + " :: " + cdef.getQualifiedName());
+
+        write("<" + cdef.getBaseName());
+
+        IMXMLEventSpecifierNode[] enodes = node.getEventSpecifierNodes();
+        if (enodes != null)
+        {
+            for (IMXMLEventSpecifierNode enode : enodes)
+            {
+                getMXMLWalker().walk(enode);
+            }
+        }
+
+        write(">");
     }
 
     //--------------------------------------------------------------------------
 
     @Override
+    public void emitEventSpecifier(IMXMLEventSpecifierNode node)
+    {
+        IDefinition cdef = node.getDefinition();
+
+        System.out.println("Emit Event Specifier: "
+                + cdef.getBaseName() + " :: " + cdef.getQualifiedName());
+
+        write(ASEmitterTokens.SPACE);
+        write(cdef.getBaseName());
+        write(ASEmitterTokens.EQUAL);
+        write(ASEmitterTokens.DOUBLE_QUOTE);
+
+        getMXMLWalker().walk(node.getChild(0));
+
+        write(ASEmitterTokens.DOUBLE_QUOTE);
+    }
+
+    @Override
     public void emitInstance(IMXMLInstanceNode node)
     {
         IClassDefinition cdef = node
                 .getClassReference((ICompilerProject) getMXMLWalker()
                         .getProject());
 
+        System.out.println("Emit Instance: "
+                + cdef.getBaseName() + " :: " + cdef.getQualifiedName());
+
         String cname = cdef.getBaseName();
 
         writeNewline("", true);
@@ -80,16 +116,17 @@ public class MXMLFlexJSEmitter extends M
             write(node.getID());
             write("\"");
         }
-
-        IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
-
         write(">");
 
-        // attributes
-        emitPropertySpecifiers(pnodes, true);
-
-        // child nodes
-        //emitPropertySpecifiers(pnodes, false);
+        IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
+        if (pnodes != null)
+        {
+            for (IMXMLPropertySpecifierNode pnode : pnodes)
+            {
+                if (!isMXMLContentNode(pnode))
+                    getMXMLWalker().walk(pnode); // Property Specifier
+            }
+        }
 
         writeNewline("");
         write("<");
@@ -101,6 +138,11 @@ public class MXMLFlexJSEmitter extends M
     @Override
     public void emitPropertySpecifier(IMXMLPropertySpecifierNode node)
     {
+        IDefinition cdef = node.getDefinition();
+
+        System.out.println("Emit Property Specifier: "
+                + cdef.getBaseName() + " :: " + cdef.getQualifiedName());
+
         writeNewline("", true);
         write("<" + node.getName() + ">");
 
@@ -118,33 +160,7 @@ public class MXMLFlexJSEmitter extends M
         final int len = node.getChildCount();
         for (int i = 0; i < len; i++)
         {
-            IASNode child = node.getChild(i);
-
-            //writeNewline("a", true);
-            getMXMLWalker().walk(child);
-            //writeNewline("~a", false);
-        }
-    }
-
-    //--------------------------------------------------------------------------
-
-    @Override
-    public void emitPropertySpecifiers(IMXMLPropertySpecifierNode[] nodes,
-            boolean emitAttributes)
-    {
-        if (nodes != null)
-        {
-            for (IMXMLPropertySpecifierNode cnode : nodes)
-            {
-                if (!isMXMLContentNode(cnode) && emitAttributes)
-                {
-                    getMXMLWalker().walk(cnode);
-                }
-                else if (isMXMLContentNode(cnode) && !emitAttributes)
-                {
-                    getMXMLWalker().walk(cnode);
-                }
-            }
+            getMXMLWalker().walk(node.getChild(i)); // Instance
         }
     }
 

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/MXMLBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/MXMLBackend.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/MXMLBackend.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/MXMLBackend.java Tue Mar  5 16:46:44 2013
@@ -22,7 +22,9 @@ package org.apache.flex.compiler.interna
 import java.io.FilterWriter;
 import java.util.List;
 
+import org.apache.flex.compiler.as.codegen.IASEmitter;
 import org.apache.flex.compiler.common.driver.IBackend;
+import org.apache.flex.compiler.internal.as.visitor.ASNodeSwitch;
 import org.apache.flex.compiler.internal.js.driver.JSBackend;
 import org.apache.flex.compiler.internal.mxml.codegen.MXMLBlockWalker;
 import org.apache.flex.compiler.internal.mxml.codegen.MXMLEmitter;
@@ -32,6 +34,8 @@ import org.apache.flex.compiler.mxml.cod
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.IASProject;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.visitor.IBlockVisitor;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 import org.apache.flex.compiler.visitor.IMXMLBlockWalker;
 
 /**
@@ -57,13 +61,18 @@ public class MXMLBackend extends JSBacke
 
     @Override
     public IMXMLBlockWalker createMXMLWalker(IASProject project,
-            List<ICompilerProblem> errors, IMXMLEmitter emitter)
+            List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+            IASEmitter asEmitter, IBlockWalker asBlockWalker)
     {
-        MXMLBlockWalker walker = new MXMLBlockWalker(errors, project, emitter);
+        MXMLBlockWalker walker = new MXMLBlockWalker(errors, project,
+                mxmlEmitter, asEmitter, asBlockWalker);
 
-        MXMLNodeSwitch strategy = new MXMLNodeSwitch(walker);
+        ASNodeSwitch asStrategy = new ASNodeSwitch(
+                (IBlockVisitor) asBlockWalker);
+        walker.setASStrategy(asStrategy);
 
-        walker.setStrategy(strategy);
+        MXMLNodeSwitch strategy = new MXMLNodeSwitch(walker);
+        walker.setMXMLStrategy(strategy);
 
         return walker;
     }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/flexjs/MXMLFlexJSBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/flexjs/MXMLFlexJSBackend.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/flexjs/MXMLFlexJSBackend.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/flexjs/MXMLFlexJSBackend.java Tue Mar  5 16:46:44 2013
@@ -22,7 +22,9 @@ package org.apache.flex.compiler.interna
 import java.io.FilterWriter;
 import java.util.List;
 
+import org.apache.flex.compiler.as.codegen.IASEmitter;
 import org.apache.flex.compiler.common.driver.IBackend;
+import org.apache.flex.compiler.internal.as.visitor.ASNodeSwitch;
 import org.apache.flex.compiler.internal.mxml.codegen.MXMLBlockWalker;
 import org.apache.flex.compiler.internal.mxml.codegen.flexjs.MXMLFlexJSBlockWalker;
 import org.apache.flex.compiler.internal.mxml.codegen.flexjs.MXMLFlexJSEmitter;
@@ -32,6 +34,8 @@ import org.apache.flex.compiler.mxml.cod
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.IASProject;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.visitor.IBlockVisitor;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 import org.apache.flex.compiler.visitor.IMXMLBlockWalker;
 
 /**
@@ -51,13 +55,18 @@ public class MXMLFlexJSBackend extends M
 
     @Override
     public IMXMLBlockWalker createMXMLWalker(IASProject project,
-            List<ICompilerProblem> errors, IMXMLEmitter emitter)
+            List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+            IASEmitter asEmitter, IBlockWalker asBlockWalker)
     {
-        MXMLFlexJSBlockWalker walker = new MXMLFlexJSBlockWalker(errors, project, emitter);
+        MXMLBlockWalker walker = new MXMLFlexJSBlockWalker(errors, project,
+                mxmlEmitter, asEmitter, asBlockWalker);
 
-        MXMLNodeSwitch strategy = new MXMLNodeSwitch(walker);
+        ASNodeSwitch asStrategy = new ASNodeSwitch(
+                (IBlockVisitor) asBlockWalker);
+        walker.setASStrategy(asStrategy);
 
-        walker.setStrategy(strategy);
+        MXMLNodeSwitch mxmlStrategy = new MXMLNodeSwitch(walker);
+        walker.setMXMLStrategy(mxmlStrategy);
 
         return walker;
     }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/MXMLNodeSwitch.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/MXMLNodeSwitch.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/MXMLNodeSwitch.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/visitor/MXMLNodeSwitch.java Tue Mar  5 16:46:44 2013
@@ -25,6 +25,7 @@ import org.apache.flex.compiler.tree.mxm
 import org.apache.flex.compiler.tree.mxml.IMXMLDeclarationsNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDeferredInstanceNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLIntNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
@@ -34,8 +35,9 @@ import org.apache.flex.compiler.tree.mxm
 import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLStyleSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLUintNode;
-import org.apache.flex.compiler.visitor.IASNodeStrategy;
+import org.apache.flex.compiler.visitor.IBlockVisitor;
 import org.apache.flex.compiler.visitor.IMXMLBlockVisitor;
+import org.apache.flex.compiler.visitor.IASNodeStrategy;
 
 /**
  * @author Michael Schmalle
@@ -45,9 +47,9 @@ public class MXMLNodeSwitch implements I
 {
     private final IMXMLBlockVisitor visitor;
 
-    public MXMLNodeSwitch(IMXMLBlockVisitor visitor)
+    public MXMLNodeSwitch(IBlockVisitor visitor)
     {
-        this.visitor = visitor;
+        this.visitor = (IMXMLBlockVisitor) visitor;
     }
 
     @Override
@@ -70,6 +72,9 @@ public class MXMLNodeSwitch implements I
         case MXMLDocumentID:
             visitor.visitDocument((IMXMLDocumentNode) node);
             break;
+        case MXMLEventSpecifierID:
+            visitor.visitEventSpecifier((IMXMLEventSpecifierNode) node);
+            break;
         case MXMLIntID:
             visitor.visitInt((IMXMLIntNode) node);
             break;
@@ -112,7 +117,6 @@ public class MXMLNodeSwitch implements I
         case MXMLDesignLayerID:
         case MXMLEmbedID:
         case MXMLEffectSpecifierID:
-        case MXMLEventSpecifierID:
         case MXMLFactoryID:
         case MXMLFileID:
         case MXMLFunctionID:

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/IMXMLEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/IMXMLEmitter.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/IMXMLEmitter.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/IMXMLEmitter.java Tue Mar  5 16:46:44 2013
@@ -22,11 +22,11 @@ package org.apache.flex.compiler.mxml.co
 import java.io.Writer;
 
 import org.apache.flex.compiler.common.codegen.IEmitter;
-import org.apache.flex.compiler.internal.mxml.codegen.MXMLBlockWalker;
 import org.apache.flex.compiler.tree.mxml.IMXMLArrayNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLBooleanNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLClassDefinitionNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLIntNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
@@ -36,8 +36,8 @@ import org.apache.flex.compiler.tree.mxm
 import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLStyleSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLUintNode;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 import org.apache.flex.compiler.visitor.IASNodeStrategy;
-import org.apache.flex.compiler.visitor.IMXMLBlockWalker;
 
 /**
  * The {@link IMXMLEmitter} interface allows abstraction between the
@@ -49,9 +49,9 @@ import org.apache.flex.compiler.visitor.
 public interface IMXMLEmitter extends IEmitter
 {
 
-    IMXMLBlockWalker getMXMLWalker();
+    IBlockWalker getMXMLWalker();
 
-    void setMXMLWalker(MXMLBlockWalker mxmlBlockWalker);
+    void setMXMLWalker(IBlockWalker mxmlBlockWalker);
 
     //--------------------------------------------------------------------------
 
@@ -65,6 +65,8 @@ public interface IMXMLEmitter extends IE
 
     //--------------------------------------------------------------------------
 
+    void emitEventSpecifier(IMXMLEventSpecifierNode node);
+
     void emitInstance(IMXMLInstanceNode node);
 
     void emitPropertySpecifier(IMXMLPropertySpecifierNode node);

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java Tue Mar  5 16:46:44 2013
@@ -77,7 +77,7 @@ import org.apache.flex.compiler.units.IC
  * 
  * @see ASBlockWalker
  */
-public interface IASBlockVisitor
+public interface IASBlockVisitor extends IBlockVisitor
 {
     //--------------------------------------------------------------------------
     // Top level nodes

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java Tue Mar  5 16:46:44 2013
@@ -20,31 +20,16 @@
 package org.apache.flex.compiler.visitor;
 
 import org.apache.flex.compiler.as.codegen.IASEmitter;
-import org.apache.flex.compiler.projects.ICompilerProject;
-import org.apache.flex.compiler.tree.as.IASNode;
 
 /**
  * @author Michael Schmalle
  */
-public interface IASBlockWalker extends IASBlockVisitor
+public interface IASBlockWalker extends IASBlockVisitor, IBlockWalker
 {
-    /**
-     * Returns the current {@link ICompilerProject} for the traverse state.
-     */
-    ICompilerProject getProject();
 
     /**
-     * Traverses an {@link IASNode} based on the semantics of the known node.
-     * <p>
-     * Typically uses the {@link IASNodeStrategy#handle(IASNode)} to delegate
-     * how the node will be traversed.
-     * 
-     * @param node The {@link IASNode} to traverse using the current strategy
-     */
-    void walk(IASNode node);
-    
-    /**
      * The current code emitter.
      */
     IASEmitter getEmitter();
+
 }

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockVisitor.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockVisitor.java?rev=1452890&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockVisitor.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockVisitor.java Tue Mar  5 16:46:44 2013
@@ -0,0 +1,28 @@
+/*
+ *
+ *  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.visitor;
+
+/**
+ * @author Erik de Bruin
+ */
+public interface IBlockVisitor
+{
+
+}

Propchange: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockWalker.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockWalker.java?rev=1452890&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockWalker.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockWalker.java Tue Mar  5 16:46:44 2013
@@ -0,0 +1,47 @@
+/*
+ *
+ *  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.visitor;
+
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.tree.as.IASNode;
+
+/**
+ * @author Michael Schmalle
+ * @author Erik de Bruin
+ */
+public interface IBlockWalker
+{
+
+    /**
+     * Returns the current {@link ICompilerProject} for the traverse state.
+     */
+    ICompilerProject getProject();
+
+    /**
+     * Traverses an {@link IASNode} based on the semantics of the known node.
+     * <p>
+     * Typically uses the {@link IASNodeStrategy#handle(IASNode)} to delegate
+     * how the node will be traversed.
+     * 
+     * @param node The {@link IASNode} to traverse using the current strategy
+     */
+    void walk(IASNode node);
+
+}

Propchange: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IBlockWalker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockVisitor.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockVisitor.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockVisitor.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockVisitor.java Tue Mar  5 16:46:44 2013
@@ -41,7 +41,7 @@ import org.apache.flex.compiler.tree.mxm
  * @author Michael Schmalle
  * @author Erik de Bruin
  */
-public interface IMXMLBlockVisitor
+public interface IMXMLBlockVisitor extends IBlockVisitor
 {
     void visitFile(IMXMLFileNode node);
 
@@ -76,11 +76,11 @@ public interface IMXMLBlockVisitor
     void visitInt(IMXMLIntNode node);
 
     void visitNumber(IMXMLNumberNode node);
-    
+
     void visitString(IMXMLStringNode node);
 
     void visitUint(IMXMLUintNode node);
-    
+
     //--------------------------------------------------------------------------
 
     void visitLiteral(IMXMLLiteralNode node);

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockWalker.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockWalker.java?rev=1452890&r1=1452889&r2=1452890&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockWalker.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/IMXMLBlockWalker.java Tue Mar  5 16:46:44 2013
@@ -19,12 +19,24 @@
 
 package org.apache.flex.compiler.visitor;
 
-import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.as.codegen.IASEmitter;
+import org.apache.flex.compiler.mxml.codegen.IMXMLEmitter;
 
 /**
  * @author Michael Schmalle
+ * @author Erik de Bruin
  */
-public interface IMXMLBlockWalker extends IMXMLBlockVisitor
+public interface IMXMLBlockWalker extends IMXMLBlockVisitor, IBlockWalker
 {
-    void walk(IASNode node);
+
+    /**
+     * The current code emitter.
+     */
+    IASEmitter getASEmitter();
+
+    /**
+     * The current code emitter.
+     */
+    IMXMLEmitter getMXMLEmitter();
+
 }



Mime
View raw message