flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erikdebr...@apache.org
Subject svn commit: r1451880 - 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 Sat, 02 Mar 2013 12:36:02 GMT
Author: erikdebruin
Date: Sat Mar  2 12:36:01 2013
New Revision: 1451880

URL: http://svn.apache.org/r1451880
Log:
Some more MXML tests and the 'passing' code.
First baby-step into the wonderful world of FlexJS :-)

Added:
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLAttributes.java   (with props)
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLNodes.java   (with props)
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLScript.java   (with props)
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSEmitter.java   (with props)
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/flexjs/
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/flexjs/MXMLFlexJSBackend.java   (with props)
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/flexjs/
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/flexjs/IMXMLFlexJSEmitter.java   (with props)
Modified:
    flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLApplication.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/internal/js/codegen/JSDocEmitter.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/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/IMXMLBlockVisitor.java

Modified: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLApplication.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLApplication.java?rev=1451880&r1=1451879&r2=1451880&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLApplication.java (original)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLApplication.java Sat Mar  2 12:36:01 2013
@@ -2,6 +2,7 @@ package org.apache.flex.compiler.interna
 
 import org.apache.flex.compiler.internal.test.MXMLTestBase;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class TestMXMLApplication extends MXMLTestBase
@@ -18,7 +19,7 @@ public class TestMXMLApplication extends
 
         mxmlBlockWalker.visitFile(node);
 
-        assertOut("<Application>\n</Application>");
+        assertOut("<Application>\n\t\n</Application>");
     }
 
     @Test
@@ -52,70 +53,44 @@ public class TestMXMLApplication extends
         assertOut("<Application>\n\t<Label id=\"myLbl\" text=\"Bye bye\"></Label>\n\t<Button id=\"myBtn\" label=\"Hello world\"></Button>\n</Application>");
     }
 
+    @Ignore
     @Test
-    public void testDefaultApp()
+    public void testBasicAppWithSimpleScript()
     {
+        // TODO (erikdebruin) handle AS script parsing...
+        
         String code = ""
-                + "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
-                + "<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\" "
-                + "               minWidth=\"955\" minHeight=\"600\">"
-                + "    <fx:Declarations>"
-                + "        <!-- Place non-visual elements (e.g., services, value objects) here -->"
-                + "    </fx:Declarations>" + "</s:Application>";
-
-        IMXMLFileNode node = compileMXML(code);
-
-        mxmlBlockWalker.visitFile(node);
-
-        assertOut("<Application minHeight=600 minWidth=955>\n</Application>");
-    }
-
-    @Test
-    public void testDefaultAppWithOneComponent()
-    {
-        String code = ""
-                + "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
-                + "<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\""
-                + "               minWidth=\"955\" minHeight=\"600\">"
-                + "    <fx:Declarations>"
-                + "        <!-- Place non-visual elements (e.g., services, value objects) here -->"
-                + "    </fx:Declarations>"
-                + "    <s:Button label=\"Click me\" />" + "</s:Application>";
+                + "<s:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:s=\"library://ns.adobe.com/flex/spark\">"
+                + "    <fx:Script><![CDATA["
+                + "        private const GREETING:String = \"Hello world!\""
+                + "    ]]></fx:Script>"
+                + "</s:Application>";
 
         IMXMLFileNode node = compileMXML(code);
 
         mxmlBlockWalker.visitFile(node);
 
-        assertOut("<Application minHeight=600 minWidth=955>\n\t<Button label=\"Click me\"></Button>\n</Application>");
+        assertOut("");
     }
 
     @Test
-    public void testDefaultAppSimpleScript()
+    public void testDefaultApp()
     {
-        // TODO (erikdebruin) handle actual script contents... 
-        //                    maybe use AS parser?
         String code = ""
                 + "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                 + "<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\""
+                + "               xmlns:s=\"library://ns.adobe.com/flex/spark\" "
+                + "               xmlns:mx=\"library://ns.adobe.com/flex/mx\" "
                 + "               minWidth=\"955\" minHeight=\"600\">"
                 + "    <fx:Declarations>"
                 + "        <!-- Place non-visual elements (e.g., services, value objects) here -->"
-                + "    </fx:Declarations>" + "    <fx:Script>"
-                + "        <![CDATA["
-                + "            // just a comment here, for now ;-)"
-                + "        ]]>" + "    </fx:Script>" + "</s:Application>";
+                + "    </fx:Declarations>" + "</s:Application>";
 
         IMXMLFileNode node = compileMXML(code);
 
         mxmlBlockWalker.visitFile(node);
 
-        assertOut("<Application minHeight=600 minWidth=955>\n</Application>");
+        assertOut("<Application minHeight=\"600\" minWidth=\"955\">\n\t\n</Application>");
     }
 
 }

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLAttributes.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLAttributes.java?rev=1451880&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLAttributes.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLAttributes.java Sat Mar  2 12:36:01 2013
@@ -0,0 +1,97 @@
+package org.apache.flex.compiler.internal.mxml.codegen;
+
+import org.apache.flex.compiler.internal.test.MXMLTestBase;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class TestMXMLAttributes extends MXMLTestBase
+{
+
+    @Ignore
+    @Test
+    public void testIdAttribute()
+    {
+        // TODO (erikdebruin) id attributes are a special case...
+        String code = "id=\"myGrp\"";
+
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_NODE);
+
+        mxmlBlockWalker.visitPropertySpecifier(node);
+
+        assertOut("id=\"myBtn\"");
+    }
+
+    @Test
+    public void testSimpleBooleanAttribute()
+    {
+        String code = "visible=\"false\"";
+
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_NODE);
+
+        mxmlBlockWalker.visitPropertySpecifier(node);
+
+        assertOut("visible=\"false\"");
+    }
+
+    @Test
+    public void testSimpleIntAttribute()
+    {
+        String code = "x=\"100\"";
+
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_NODE);
+
+        mxmlBlockWalker.visitPropertySpecifier(node);
+
+        assertOut("x=\"100\"");
+    }
+
+    @Test
+    public void testSimpleNumberAttribute()
+    {
+        String code = "width=\"1.5\"";
+
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_NODE);
+
+        mxmlBlockWalker.visitPropertySpecifier(node);
+
+        assertOut("width=\"1.5\"");
+    }
+
+    @Test
+    public void testSimpleStringAttribute()
+    {
+        String code = "label=\"Click me ;-)\"";
+
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_NODE);
+
+        mxmlBlockWalker.visitPropertySpecifier(node);
+
+        assertOut("label=\"Click me ;-)\"");
+    }
+    
+    @Test
+    public void testSimpleUintAttribute()
+    {
+        String code = "color=\"0xFF0000\"";
+
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_NODE);
+
+        mxmlBlockWalker.visitPropertySpecifier(node);
+
+        assertOut("color=\"16711680\"");
+    }
+
+}

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

Added: flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLNodes.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLNodes.java?rev=1451880&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLNodes.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLNodes.java Sat Mar  2 12:36:01 2013
@@ -0,0 +1,170 @@
+package org.apache.flex.compiler.internal.mxml.codegen;
+
+import org.apache.flex.compiler.internal.test.MXMLTestBase;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.junit.Test;
+
+public class TestMXMLNodes extends MXMLTestBase
+{
+
+    @Test
+    public void testSimpleNode()
+    {
+        String code = "<s:Button />";
+
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+
+        mxmlBlockWalker.visitPropertySpecifier(node);
+
+        assertOut("<Button></Button>");
+    }
+
+    @Test
+    public void testSimpleNodeWithId()
+    {
+        String code = "<s:Button id=\"myBtn\"/>";
+
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+
+        mxmlBlockWalker.visitPropertySpecifier(node);
+
+        assertOut("<Button id=\"myBtn\"></Button>");
+    }
+
+    @Test
+    public void testSimpleNodeWithAttribute()
+    {
+        String code = "<s:Button label=\"Click me\" />";
+
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+
+        mxmlBlockWalker.visitPropertySpecifier(node);
+
+        assertOut("<Button label=\"Click me\"></Button>");
+    }
+
+    @Test
+    public void testSimpleNodeWithInnerText()
+    {
+        String code = "<s:Button>Click me</s:Button>";
+
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+
+        mxmlBlockWalker.visitPropertySpecifier(node);
+
+        assertOut("<Button label=\"Click me\"></Button>");
+    }
+    
+    @Test
+    public void testAnotherSimpleNodeWithInnerText()
+    {
+        String code = "<s:Label>Hello World!</s:Label>";
+        
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+        
+        mxmlBlockWalker.visitPropertySpecifier(node);
+        
+        assertOut("<Label text=\"Hello World!\"></Label>");
+    }
+    
+    @Test
+    public void testSimpleNodeWithMultipleAttributes()
+    {
+        String code = "<s:Button visible=\"false\" x=\"100\" width=\"1.5\" label=\"Click me ;-)\" color=\"0xFF0000\"/>";
+        
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+        
+        mxmlBlockWalker.visitPropertySpecifier(node);
+        
+        assertOut("<Button visible=\"false\" color=\"16711680\" width=\"1.5\" label=\"Click me ;-)\" x=\"100\"></Button>");
+    }
+    
+    @Test
+    public void testNodeWithChild()
+    {
+        String code = "<s:Group><s:RadioButton /></s:Group>";
+        
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+        
+        mxmlBlockWalker.visitPropertySpecifier(node);
+        
+        assertOut("<Group><RadioButton></RadioButton></Group>");
+    }
+
+    @Test
+    public void testNodeWithChildAndAttribute()
+    {
+        String code = "<s:Group id=\"myGrp\"><s:RadioButton /></s:Group>";
+        
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+        
+        mxmlBlockWalker.visitPropertySpecifier(node);
+        
+        assertOut("<Group id=\"myGrp\"><RadioButton></RadioButton></Group>");
+    }
+
+    @Test
+    public void testNodeWithNestedChildren()
+    {
+        String code = "<s:Group><s:Group><s:Group>" +
+        		"<s:RadioButton />" +
+        		"</s:Group></s:Group></s:Group>";
+        
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+        
+        mxmlBlockWalker.visitPropertySpecifier(node);
+        
+        assertOut("<Group><Group><Group><RadioButton></RadioButton></Group></Group></Group>");
+    }
+
+    @Test
+    public void testNodeWithNestedChildrenAndAttribute()
+    {
+        String code = "<s:Group><s:Group><s:Group>" +
+                "<s:RadioButton id=\"myRB\"/>" +
+                "</s:Group></s:Group></s:Group>";
+        
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+        
+        mxmlBlockWalker.visitPropertySpecifier(node);
+        
+        assertOut("<Group><Group><Group><RadioButton id=\"myRB\"></RadioButton></Group></Group></Group>");
+    }
+
+    @Test
+    public void testNodeWithNestedChildrenAndInnerText()
+    {
+        String code = "<s:Group><s:Group><s:Group>" +
+                "<s:Button>Click me</s:Button>" +
+                "</s:Group></s:Group></s:Group>";
+        
+        IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode(
+                code, IMXMLPropertySpecifierNode.class,
+                MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+        
+        mxmlBlockWalker.visitPropertySpecifier(node);
+        
+        assertOut("<Group><Group><Group><Button label=\"Click me\"></Button></Group></Group></Group>");
+    }
+
+}

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

Added: 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=1451880&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLScript.java (added)
+++ flex/falcon/trunk/compiler.jx.tests/src/org/apache/flex/compiler/internal/mxml/codegen/TestMXMLScript.java Sat Mar  2 12:36:01 2013
@@ -0,0 +1,45 @@
+package org.apache.flex.compiler.internal.mxml.codegen;
+
+import org.apache.flex.compiler.internal.test.MXMLTestBase;
+import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class TestMXMLScript extends MXMLTestBase
+{
+
+    @Test
+    public void testEmptyScript()
+    {
+        String code = ""
+                + "<fx:Script><![CDATA[]]></fx:Script>";
+
+        IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
+                IMXMLScriptNode.class, MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+
+        mxmlBlockWalker.visitScript(node);
+
+        assertOut("");
+    }
+
+    @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!\""
+                + "]]></fx:Script>";
+
+        IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
+                IMXMLScriptNode.class, MXMLTestBase.WRAP_LEVEL_DOCUMENT);
+
+        mxmlBlockWalker.visitScript(node);
+
+        assertOut("");
+    }
+
+}

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

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=1451880&r1=1451879&r2=1451880&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 Sat Mar  2 12:36:01 2013
@@ -10,9 +10,25 @@ import org.junit.Test;
 public class TestFlexJSMXMLApplication extends FlexJSTestBase
 {
 
-    @Ignore
+    /*
+    <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
-    public void testBasicAppMx()
+    public void testBasicFlexJSApp()
     {
         String code = ""
                 + "<basic:Application xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
@@ -22,8 +38,44 @@ public class TestFlexJSMXMLApplication e
 
         mxmlBlockWalker.visitFile(node);
 
-        // TODO (erikdebruin) this needs to become JS Goog output ;-)
-        assertOut("<Application>\n</Application>");
+        assertOut("<Application>\n\t\n</Application>");
+    }
+
+    @Test
+    public void testFlexJSAppWithNode()
+    {
+        String code = ""
+                + "<basic:Application xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
+                + "    <basic:beads />"
+                + "</basic:Application>";
+        
+        IMXMLFileNode node = compileMXML(code);
+
+        mxmlBlockWalker.visitFile(node);
+
+        assertOut("<Application>\n\t<beads></beads>\n</Application>");
+    }
+    
+    @Ignore
+    @Test
+    public void testFlexJSAppWithNodeAndChild()
+    {
+        String code = ""
+                + "<basic:Application xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
+                + "    <basic:beads>"
+                + "        <basic:HTTPService id=\"service\">"
+                + "            <basic:LazyCollection id=\"collection\" />"
+                + "        </basic:HTTPService>"
+                + "    </basic:beads>"
+                + "</basic:Application>";
+        
+        IMXMLFileNode node = compileMXML(code);
+        
+        mxmlBlockWalker.visitFile(node);
+        
+        System.out.println(writer.toString());
+        
+        assertOut("<Application>\n\t<beads><org.apache.flex.net.HTTPService id=\"service\"></org.apache.flex.net.HTTPService></beads>\n</Application>");
     }
 
     @Ignore

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=1451880&r1=1451879&r2=1451880&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 Sat Mar  2 12:36:01 2013
@@ -3,7 +3,7 @@ package org.apache.flex.compiler.interna
 import java.io.File;
 
 import org.apache.flex.compiler.common.driver.IBackend;
-import org.apache.flex.compiler.internal.mxml.driver.MXMLBackend;
+import org.apache.flex.compiler.internal.mxml.driver.flexjs.MXMLFlexJSBackend;
 import org.apache.flex.compiler.mxml.MXMLNamespaceMapping;
 import org.apache.flex.utils.FilenameNormalization;
 import org.junit.Ignore;
@@ -53,7 +53,7 @@ public class FlexJSTestBase extends Test
     @Override
     protected IBackend createBackend()
     {
-        return new MXMLBackend();
+        return new MXMLFlexJSBackend();
     }
 
 }

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=1451880&r1=1451879&r2=1451880&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 Sat Mar  2 12:36:01 2013
@@ -5,6 +5,9 @@ import java.io.File;
 import org.apache.flex.compiler.common.driver.IBackend;
 import org.apache.flex.compiler.internal.mxml.driver.MXMLBackend;
 import org.apache.flex.compiler.mxml.MXMLNamespaceMapping;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
 import org.apache.flex.utils.FilenameNormalization;
 import org.junit.Ignore;
 
@@ -60,4 +63,61 @@ public class MXMLTestBase extends TestBa
         return new MXMLBackend();
     }
 
+    //--------------------------------------------------------------------------
+    // Node "factory"
+    //--------------------------------------------------------------------------
+
+    public static final int WRAP_LEVEL_DOCUMENT = 1;
+    public static final int WRAP_LEVEL_NODE = 2;
+
+    protected IMXMLNode getNode(String code, Class<? extends IMXMLNode> type,
+            int wrapLevel)
+    {
+        if (wrapLevel >= WRAP_LEVEL_NODE)
+            code = "<s:Button " + code + "></s:Button>";
+
+        if (wrapLevel >= WRAP_LEVEL_DOCUMENT)
+            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>";
+
+        IMXMLFileNode node = compileMXML(code);
+
+        if (wrapLevel >= WRAP_LEVEL_NODE) // for now: attributes
+        {
+            IMXMLNode pnode = findFirstDescendantOfType(node,
+                    IMXMLPropertySpecifierNode.class);
+
+            IMXMLNode cnode = findFirstDescendantOfType(pnode,
+                    IMXMLPropertySpecifierNode.class);
+
+            return (IMXMLNode) cnode;
+        }
+        else
+        {
+            return (IMXMLNode) findFirstDescendantOfType(node, type);
+        }
+    }
+
+    protected IMXMLNode findFirstDescendantOfType(IMXMLNode node,
+            Class<? extends IMXMLNode> nodeType)
+    {
+
+        int n = node.getChildCount();
+        for (int i = 0; i < n; i++)
+        {
+            IMXMLNode child = (IMXMLNode) node.getChild(i);
+            if (nodeType.isInstance(child))
+                return child;
+
+            IMXMLNode found = (IMXMLNode) findFirstDescendantOfType(child,
+                    nodeType);
+            if (found != null)
+                return found;
+        }
+
+        return null;
+    }
 }

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/JSDocEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/JSDocEmitter.java?rev=1451880&r1=1451879&r2=1451880&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/JSDocEmitter.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/JSDocEmitter.java Sat Mar  2 12:36:01 2013
@@ -25,6 +25,7 @@ import org.apache.flex.compiler.common.c
 import org.apache.flex.compiler.internal.as.codegen.ASEmitterTokens;
 import org.apache.flex.compiler.js.codegen.IJSEmitter;
 
+@SuppressWarnings("unused")
 public class JSDocEmitter implements IDocEmitter, IEmitter
 {
 

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=1451880&r1=1451879&r2=1451880&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 Sat Mar  2 12:36:01 2013
@@ -26,6 +26,7 @@ import org.apache.flex.compiler.problems
 import org.apache.flex.compiler.projects.IASProject;
 import org.apache.flex.compiler.tree.as.IASNode;
 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.IMXMLDeclarationsNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDeferredInstanceNode;
@@ -35,10 +36,12 @@ 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.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.IMXMLBlockVisitor;
 import org.apache.flex.compiler.visitor.IMXMLBlockWalker;
@@ -145,15 +148,7 @@ public class MXMLBlockWalker implements 
     }
 
     //--------------------------------------------------------------------------
-
-    @Override
-    public void visitPropertySpecifier(IMXMLPropertySpecifierNode node)
-    {
-        debug("visitPropertySpecifier()");
-
-        emitter.emitPropertySpecifier(node);
-    }
-
+    
     @Override
     public void visitEventSpecifier(IMXMLEventSpecifierNode node)
     {
@@ -161,23 +156,35 @@ public class MXMLBlockWalker implements 
     }
 
     @Override
-    public void visitStyleSpecifier(IMXMLStyleSpecifierNode node)
+    public void visitInstance(IMXMLInstanceNode node)
     {
-        debug("visitStyleSpecifier()");
+        debug("visitInstance()");
+
+        emitter.emitInstance(node);
     }
 
     @Override
-    public void visitInstance(IMXMLInstanceNode node)
+    public void visitPropertySpecifier(IMXMLPropertySpecifierNode node)
     {
-        debug("visitInstance()");
+        debug("visitPropertySpecifier()");
 
-        emitter.emitInstance(node);
+        emitter.emitPropertySpecifier(node);
     }
 
     @Override
     public void visitScript(IMXMLScriptNode node)
     {
         debug("visitScript()");
+
+        emitter.emitScript(node);
+    }
+
+    @Override
+    public void visitStyleSpecifier(IMXMLStyleSpecifierNode node)
+    {
+        debug("visitStyleSpecifier()");
+
+        emitter.emitStyleSpecifier(node);
     }
 
     //--------------------------------------------------------------------------
@@ -191,6 +198,14 @@ public class MXMLBlockWalker implements 
     }
 
     @Override
+    public void visitBoolean(IMXMLBooleanNode node)
+    {
+        debug("visitBoolean()");
+        
+        emitter.emitBoolean(node);
+    }
+    
+    @Override
     public void visitInt(IMXMLIntNode node)
     {
         debug("visitInt()");
@@ -199,6 +214,14 @@ public class MXMLBlockWalker implements 
     }
 
     @Override
+    public void visitNumber(IMXMLNumberNode node)
+    {
+        debug("visitNumber()");
+        
+        emitter.emitNumber(node);
+    }
+    
+    @Override
     public void visitString(IMXMLStringNode node)
     {
         debug("visitString()");
@@ -206,6 +229,14 @@ public class MXMLBlockWalker implements 
         emitter.emitString(node);
     }
 
+    @Override
+    public void visitUint(IMXMLUintNode node)
+    {
+        debug("visitUint()");
+        
+        emitter.emitUint(node);
+    }
+    
     //--------------------------------------------------------------------------
 
     @Override

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=1451880&r1=1451879&r2=1451880&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 Sat Mar  2 12:36:01 2013
@@ -28,15 +28,20 @@ import org.apache.flex.compiler.mxml.cod
 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.IMXMLBooleanNode;
 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.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;
 
 /**
  * The base implementation for an MXML emitter.
@@ -46,7 +51,7 @@ import org.apache.flex.compiler.tree.mxm
 public class MXMLEmitter extends Emitter implements IMXMLEmitter
 {
 
-    private MXMLBlockWalker walker;
+    protected MXMLBlockWalker walker;
 
     @Override
     public MXMLBlockWalker getMXMLWalker()
@@ -75,18 +80,9 @@ public class MXMLEmitter extends Emitter
 
         write("<" + cdef.getBaseName());
 
-        IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
-        if (pnodes != null)
-        {
-            for (IMXMLPropertySpecifierNode pnode : pnodes)
-            {
-                if (!pnode.getName().equals("mxmlContentFactory"))
-                    getMXMLWalker().walk(pnode);
-            }
-        }
+        emitPropertySpecifiers(node.getPropertySpecifierNodes(), true);
 
-        write(">");
-        indentPush();
+        writeNewline(">", true);
     }
 
     @Override
@@ -104,39 +100,29 @@ public class MXMLEmitter extends Emitter
     @Override
     public void emitClass(IMXMLClassDefinitionNode node)
     {
-        // fx:script tag contents
-        IMXMLScriptNode[] snodes = node.getScriptNodes();
-        if (snodes != null)
-        {
-            for (IMXMLScriptNode snode : snodes)
-            {
-                for (IASNode asnode : snode.getASNodes())
-                {
-                    getMXMLWalker().walk(asnode);
-                }
-            }
-        }
 
-        // "regular" tags (components)
-        IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
-        if (pnodes != null)
+        // fx:declarations
+        IMXMLDeclarationsNode[] dnodes = node.getDeclarationsNodes();
+        if (dnodes != null)
         {
-            for (IMXMLPropertySpecifierNode pnode : pnodes)
+            for (IMXMLDeclarationsNode dnode : dnodes)
             {
-                if (pnode.getName().equals("mxmlContentFactory"))
-                    getMXMLWalker().walk(pnode);
+                getMXMLWalker().walk(dnode);
             }
         }
 
-        // fx:declarations tag contents
-        IMXMLDeclarationsNode[] dnodes = node.getDeclarationsNodes();
-        if (dnodes != null)
+        // fx:script
+        IMXMLScriptNode[] snodes = node.getScriptNodes();
+        if (snodes != null)
         {
-            for (IMXMLDeclarationsNode dnode : dnodes)
+            for (IMXMLScriptNode snode : snodes)
             {
-                getMXMLWalker().walk(dnode);
+                getMXMLWalker().walk(snode);
             }
         }
+
+        // "regular" tags
+        emitPropertySpecifiers(node.getPropertySpecifierNodes(), false);
     }
 
     //--------------------------------------------------------------------------
@@ -150,7 +136,6 @@ public class MXMLEmitter extends Emitter
 
         String cname = cdef.getBaseName();
 
-        writeNewline();
         write("<");
         write(cname);
         if (node.getID() != null && node.getID() != "")
@@ -164,17 +149,15 @@ public class MXMLEmitter extends Emitter
         }
 
         IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
-        final int len = pnodes.length;
-        if (len != 0)
-        {
-            for (int i = 0; i < len; i++)
-            {
-                getMXMLWalker().walk(pnodes[i]);
-            }
-        }
+
+        // attributes
+        emitPropertySpecifiers(pnodes, true);
 
         write(">");
-        // TODO (erikdebruin) we need to parse any children, if present...
+
+        // child nodes
+        emitPropertySpecifiers(pnodes, false);
+
         write("<");
         write("/");
         write(cname);
@@ -184,12 +167,20 @@ public class MXMLEmitter extends Emitter
     @Override
     public void emitPropertySpecifier(IMXMLPropertySpecifierNode node)
     {
-        boolean isMXMLContentFactory = node.getName().equals(
-                "mxmlContentFactory");
+        if (!isMXMLContentNode(node)) // only for attributes
+        {
+            write(node.getName());
+            write(ASEmitterTokens.EQUAL);
+        }
 
-        if (!isMXMLContentFactory)
+        getMXMLWalker().walk(node.getInstanceNode());
+    }
+
+    @Override
+    public void emitStyleSpecifier(IMXMLStyleSpecifierNode node)
+    {
+        if (!isMXMLContentNode(node)) // only for attributes
         {
-            write(ASEmitterTokens.SPACE);
             write(node.getName());
             write(ASEmitterTokens.EQUAL);
         }
@@ -197,6 +188,12 @@ public class MXMLEmitter extends Emitter
         getMXMLWalker().walk(node.getInstanceNode());
     }
 
+    @Override
+    public void emitScript(IMXMLScriptNode node)
+    {
+        // TODO (erikdebruin) handle AS script parsing...
+    }
+
     //--------------------------------------------------------------------------
 
     @Override
@@ -205,24 +202,43 @@ public class MXMLEmitter extends Emitter
         final int len = node.getChildCount();
         for (int i = 0; i < len; i++)
         {
-            getMXMLWalker().walk(node.getChild(i));
+            IASNode child = node.getChild(i);
+
+            getMXMLWalker().walk(child);
+
+            if (child instanceof IMXMLInstanceNode && i < len - 1)
+                writeNewline();
         }
     }
 
     @Override
+    public void emitBoolean(IMXMLBooleanNode node)
+    {
+        emitAttributeValue(node.getChild(0));
+    }
+
+    @Override
     public void emitInt(IMXMLIntNode node)
     {
-        getMXMLWalker().walk(node.getChild(0));
+        emitAttributeValue(node.getChild(0));
     }
 
     @Override
+    public void emitNumber(IMXMLNumberNode node)
+    {
+        emitAttributeValue(node.getChild(0));
+    }
+    
+    @Override
     public void emitString(IMXMLStringNode node)
     {
-        write("\"");
-
-        getMXMLWalker().walk(node.getChild(0));
-
-        write("\"");
+        emitAttributeValue(node.getChild(0));
+    }
+    
+    @Override
+    public void emitUint(IMXMLUintNode node)
+    {
+        emitAttributeValue(node.getChild(0));
     }
 
     //--------------------------------------------------------------------------
@@ -233,4 +249,43 @@ public class MXMLEmitter extends Emitter
         write(node.getValue().toString());
     }
 
+    //--------------------------------------------------------------------------
+    //  utils
+    //--------------------------------------------------------------------------
+
+    protected void emitPropertySpecifiers(IMXMLPropertySpecifierNode[] nodes,
+            boolean emitAttributes)
+    {
+        if (nodes != null)
+        {
+            for (IMXMLPropertySpecifierNode cnode : nodes)
+            {
+                if (!isMXMLContentNode(cnode) && emitAttributes)
+                {
+                    write(ASEmitterTokens.SPACE);
+                    getMXMLWalker().walk(cnode);
+                }
+                else if (isMXMLContentNode(cnode) && !emitAttributes)
+                {
+                    getMXMLWalker().walk(cnode);
+                }
+            }
+        }
+    }
+
+    protected void emitAttributeValue(IASNode node)
+    {
+        write("\"");
+
+        getMXMLWalker().walk(node);
+
+        write("\"");
+    }
+
+    protected boolean isMXMLContentNode(IMXMLNode node)
+    {
+        return node.getName().equals("mxmlContentFactory")
+                || node.getName().equals("mxmlContent");
+    }
+
 }

Added: 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=1451880&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSEmitter.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSEmitter.java Sat Mar  2 12:36:01 2013
@@ -0,0 +1,161 @@
+/*
+ *
+ *  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.mxml.codegen.flexjs;
+
+import java.io.FilterWriter;
+
+import org.apache.flex.compiler.definitions.IClassDefinition;
+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.IMXMLClassDefinitionNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+
+/**
+ * The base implementation for an MXML emitter.
+ * 
+ * @author Erik de Bruin
+ */
+public class MXMLFlexJSEmitter extends MXMLEmitter implements IMXMLFlexJSEmitter
+{
+
+    public MXMLFlexJSEmitter(FilterWriter out)
+    {
+        super(out);
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void emitDocumentHeader(IMXMLDocumentNode node)
+    {
+        IClassDefinition cdef = node
+                .getClassReference((ICompilerProject) walker.getProject());
+
+        writeNewline("<" + cdef.getBaseName() + ">", true);
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void emitClass(IMXMLClassDefinitionNode node)
+    {
+        // "regular" tags
+        IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
+        if (pnodes != null)
+        {
+            for (IMXMLPropertySpecifierNode pnode : pnodes)
+            {
+                getMXMLWalker().walk(pnode);
+            }
+        }
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void emitInstance(IMXMLInstanceNode node)
+    {
+        String cname = node.getName();
+
+        write("<");
+        write(cname);
+        if (node.getID() != null && node.getID() != "")
+        {
+            write(ASEmitterTokens.SPACE);
+            write("id");
+            write(ASEmitterTokens.EQUAL);
+            write("\"");
+            write(node.getID());
+            write("\"");
+        }
+//
+//        IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
+//
+//        // attributes
+//        emitPropertySpecifiers(pnodes, true);
+
+        write(">");
+
+        // child nodes
+        int len = node.getChildCount();
+        if (len > 0)
+        {
+            for (int i = 0; i < len; i++)
+            {
+                IASNode cnode = node.getChild(i);
+                
+                getMXMLWalker().walk(cnode);
+            }
+        }
+
+        write("<");
+        write("/");
+        write(cname);
+        write(">");
+    }
+
+    @Override
+    public void emitPropertySpecifier(IMXMLPropertySpecifierNode  node)
+    {
+        String cname = node.getName();
+
+        write("<");
+        write(cname);
+//        if (node.getID() != null && node.getID() != "")
+//        {
+//            write(ASEmitterTokens.SPACE);
+//            write("id");
+//            write(ASEmitterTokens.EQUAL);
+//            write("\"");
+//            write(node.getID());
+//            write("\"");
+//        }
+//
+//        IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
+//
+//        // attributes
+//        emitPropertySpecifiers(pnodes, true);
+
+        write(">");
+
+        // child nodes
+        int len = node.getChildCount();
+        if (len > 0)
+        {
+            for (int i = 0; i < len; i++)
+            {
+                IASNode cnode = node.getChild(i);
+                
+                getMXMLWalker().walk(cnode);
+            }
+        }
+
+        write("<");
+        write("/");
+        write(cname);
+        write(">");
+    }
+
+}

Propchange: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/codegen/flexjs/MXMLFlexJSEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=1451880&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/flexjs/MXMLFlexJSBackend.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/flexjs/MXMLFlexJSBackend.java Sat Mar  2 12:36:01 2013
@@ -0,0 +1,46 @@
+/*
+ *
+ *  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.mxml.driver.flexjs;
+
+import java.io.FilterWriter;
+
+import org.apache.flex.compiler.common.driver.IBackend;
+import org.apache.flex.compiler.internal.mxml.codegen.MXMLBlockWalker;
+import org.apache.flex.compiler.internal.mxml.codegen.flexjs.MXMLFlexJSEmitter;
+import org.apache.flex.compiler.internal.mxml.driver.MXMLBackend;
+import org.apache.flex.compiler.mxml.codegen.IMXMLEmitter;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+
+/**
+ * A concrete implementation of the {@link IBackend} API where the
+ * {@link MXMLBlockWalker} is used to traverse the {@link IMXMLFileNode} AST.
+ * 
+ * @author Erik de Bruin
+ */
+public class MXMLFlexJSBackend extends MXMLBackend
+{
+
+    @Override
+    public IMXMLEmitter createMXMLEmitter(FilterWriter out)
+    {
+        return new MXMLFlexJSEmitter(out);
+    }
+
+}

Propchange: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/mxml/driver/flexjs/MXMLFlexJSBackend.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=1451880&r1=1451879&r2=1451880&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 Sat Mar  2 12:36:01 2013
@@ -21,14 +21,19 @@ package org.apache.flex.compiler.interna
 
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLArrayNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLBooleanNode;
 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.IMXMLInstanceNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLIntNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
+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.IMXMLBlockVisitor;
 
@@ -53,6 +58,9 @@ public class MXMLNodeSwitch implements I
         case MXMLArrayID:
             visitor.visitArray((IMXMLArrayNode) node);
             break;
+        case MXMLBooleanID:
+            visitor.visitBoolean((IMXMLBooleanNode) node);
+            break;
         case MXMLDeclarationsID:
             visitor.visitDeclarations((IMXMLDeclarationsNode) node);
             break;
@@ -71,17 +79,28 @@ public class MXMLNodeSwitch implements I
         case MXMLLiteralID:
             visitor.visitLiteral((IMXMLLiteralNode) node);
             break;
+        case MXMLNumberID:
+            visitor.visitNumber((IMXMLNumberNode) node);
+            break;
         case MXMLPropertySpecifierID:
             visitor.visitPropertySpecifier((IMXMLPropertySpecifierNode) node);
             break;
+        case MXMLScriptID:
+            visitor.visitScript((IMXMLScriptNode) node);
+            break;
         case MXMLStringID:
             visitor.visitString((IMXMLStringNode) node);
             break;
+        case MXMLStyleSpecifierID:
+            visitor.visitStyleSpecifier((IMXMLStyleSpecifierNode) node);
+            break;
+        case MXMLUintID:
+            visitor.visitUint((IMXMLUintNode) node);
+            break;
 
         case MXMLApplicationID:
         case MXMLBindingID:
         case MXMLBindingAttributeID:
-        case MXMLBooleanID:
         case MXMLClassID:
         case MXMLClassDefinitionID:
         case MXMLClearID:
@@ -105,7 +124,6 @@ public class MXMLNodeSwitch implements I
         case MXMLModelID:
         case MXMLModelPropertyID:
         case MXMLModelRootID:
-        case MXMLNumberID:
         case MXMLObjectID:
         case MXMLPrivateID:
         case MXMLRegExpID:
@@ -114,11 +132,8 @@ public class MXMLNodeSwitch implements I
         case MXMLReparentID:
         case MXMLRepeaterID:
         case MXMLResourceID:
-        case MXMLScriptID:
         case MXMLStateID:
         case MXMLStyleID:
-        case MXMLStyleSpecifierID:
-        case MXMLUintID:
         case MXMLVectorID:
         case MXMLWebServiceID:
         case MXMLWebServiceOperationID:

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=1451880&r1=1451879&r2=1451880&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 Sat Mar  2 12:36:01 2013
@@ -24,13 +24,18 @@ 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.IMXMLInstanceNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLIntNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
+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.IMXMLBlockWalker;
 
@@ -64,14 +69,24 @@ public interface IMXMLEmitter extends IE
 
     void emitPropertySpecifier(IMXMLPropertySpecifierNode node);
 
+    void emitScript(IMXMLScriptNode node);
+
+    void emitStyleSpecifier(IMXMLStyleSpecifierNode node);
+
     //--------------------------------------------------------------------------
 
     void emitArray(IMXMLArrayNode node);
 
+    void emitBoolean(IMXMLBooleanNode node);
+    
     void emitInt(IMXMLIntNode node);
 
-    void emitString(IMXMLStringNode node);
+    void emitNumber(IMXMLNumberNode node);
 
+    void emitString(IMXMLStringNode node);
+    
+    void emitUint(IMXMLUintNode node);
+    
     //--------------------------------------------------------------------------
 
     void emitLiteral(IMXMLLiteralNode node);

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/flexjs/IMXMLFlexJSEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/flexjs/IMXMLFlexJSEmitter.java?rev=1451880&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/flexjs/IMXMLFlexJSEmitter.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/flexjs/IMXMLFlexJSEmitter.java Sat Mar  2 12:36:01 2013
@@ -0,0 +1,36 @@
+/*
+ *
+ *  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.mxml.codegen.flexjs;
+
+import java.io.Writer;
+
+import org.apache.flex.compiler.mxml.codegen.IMXMLEmitter;
+import org.apache.flex.compiler.visitor.IASNodeStrategy;
+
+/**
+ * The {@link IMXMLFlexJSEmitter} interface allows abstraction between the
+ * {@link IASNodeStrategy} and the current output buffer {@link Writer}.
+ * 
+ * @author Erik de Bruin
+ */
+public interface IMXMLFlexJSEmitter extends IMXMLEmitter
+{
+
+}

Propchange: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/mxml/codegen/flexjs/IMXMLFlexJSEmitter.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=1451880&r1=1451879&r2=1451880&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 Sat Mar  2 12:36:01 2013
@@ -20,6 +20,7 @@
 package org.apache.flex.compiler.visitor;
 
 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.IMXMLDeclarationsNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDeferredInstanceNode;
@@ -29,10 +30,12 @@ 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.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;
 
 /**
  * @author Michael Schmalle
@@ -54,24 +57,30 @@ public interface IMXMLBlockVisitor
 
     //--------------------------------------------------------------------------
 
-    void visitPropertySpecifier(IMXMLPropertySpecifierNode node);
-
     void visitEventSpecifier(IMXMLEventSpecifierNode node);
 
-    void visitStyleSpecifier(IMXMLStyleSpecifierNode node);
-
     void visitInstance(IMXMLInstanceNode node);
 
+    void visitPropertySpecifier(IMXMLPropertySpecifierNode node);
+
     void visitScript(IMXMLScriptNode node);
 
+    void visitStyleSpecifier(IMXMLStyleSpecifierNode node);
+
     //--------------------------------------------------------------------------
 
     void visitArray(IMXMLArrayNode node);
 
+    void visitBoolean(IMXMLBooleanNode node);
+
     void visitInt(IMXMLIntNode node);
 
+    void visitNumber(IMXMLNumberNode node);
+    
     void visitString(IMXMLStringNode node);
 
+    void visitUint(IMXMLUintNode node);
+    
     //--------------------------------------------------------------------------
 
     void visitLiteral(IMXMLLiteralNode node);



Mime
View raw message