flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1452955 [8/9] - in /flex/falcon/trunk: compiler.jx.tests/src/org/apache/flex/compiler/internal/as/ compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/ compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/ compile...
Date Tue, 05 Mar 2013 19:22:09 GMT
Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,309 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.mxml;
+
+import java.util.List;
+
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.mxml.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.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;
+import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+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.IBlockWalker;
+import org.apache.flex.compiler.visitor.IASNodeStrategy;
+import org.apache.flex.compiler.visitor.mxml.IMXMLBlockVisitor;
+import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
+
+/**
+ * @author Michael Schmalle
+ * @author Erik de Bruin
+ */
+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;
+
+    List<ICompilerProblem> getErrors()
+    {
+        return errors;
+    }
+
+    //----------------------------------
+    // project
+    //----------------------------------
+
+    private IASProject project;
+
+    public IASProject getProject()
+    {
+        return project;
+    }
+
+    //----------------------------------
+    // strategy
+    //----------------------------------
+
+    private IASNodeStrategy mxmlStrategy;
+
+    public IASNodeStrategy getMXMLStrategy()
+    {
+        return mxmlStrategy;
+    }
+
+    public void setMXMLStrategy(IASNodeStrategy value)
+    {
+        mxmlStrategy = value;
+    }
+
+    private IASNodeStrategy asStrategy;
+
+    public IASNodeStrategy getASStrategy()
+    {
+        return asStrategy;
+    }
+
+    public void setASStrategy(IASNodeStrategy value)
+    {
+        asStrategy = value;
+    }
+
+    //----------------------------------
+    // walk
+    //----------------------------------
+
+    @Override
+    public void walk(IASNode node)
+    {
+        if (node instanceof IMXMLNode)
+            mxmlStrategy.handle(node);
+        else
+            asStrategy.handle(node);
+    }
+
+    public MXMLBlockWalker(List<ICompilerProblem> errors, IASProject project,
+            IMXMLEmitter mxmlEmitter, IASEmitter asEmitter,
+            IBlockWalker asBlockWalker)
+    {
+        this.asEmitter = asEmitter;
+        this.mxmlEmitter = mxmlEmitter;
+        this.project = project;
+        this.errors = errors;
+
+        asEmitter.setWalker(asBlockWalker);
+
+        mxmlEmitter.setMXMLWalker((IBlockWalker) this);
+    }
+
+    @Override
+    public void visitFile(IMXMLFileNode node)
+    {
+        debug("visitFile()");
+
+        walk(node.getDocumentNode());
+    }
+
+    @Override
+    public void visitDeclarations(IMXMLDeclarationsNode node)
+    {
+        debug("visitDeclarations()");
+
+        //
+    }
+
+    @Override
+    public void visitDocument(IMXMLDocumentNode node)
+    {
+        debug("visitDocument()");
+
+        mxmlEmitter.emitDocumentHeader(node);
+        visitClassDefinition(node);
+        mxmlEmitter.emitDocumentFooter(node);
+    }
+
+    @Override
+    public void visitClassDefinition(IMXMLClassDefinitionNode node)
+    {
+        debug("visitClassDefinition()");
+
+        mxmlEmitter.emitClass(node);
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void visitDeferredInstance(IMXMLDeferredInstanceNode node)
+    {
+        debug("visitdeferredInstance()");
+
+        walk(node.getChild(0));
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void visitEventSpecifier(IMXMLEventSpecifierNode node)
+    {
+        debug("visitEventSpecifier()");
+
+        mxmlEmitter.emitEventSpecifier(node);
+    }
+
+    @Override
+    public void visitInstance(IMXMLInstanceNode node)
+    {
+        debug("visitInstance()");
+
+        mxmlEmitter.emitInstance(node);
+    }
+
+    @Override
+    public void visitPropertySpecifier(IMXMLPropertySpecifierNode node)
+    {
+        debug("visitPropertySpecifier()");
+
+        mxmlEmitter.emitPropertySpecifier(node);
+    }
+
+    @Override
+    public void visitScript(IMXMLScriptNode node)
+    {
+        debug("visitScript()");
+
+        mxmlEmitter.emitScript(node);
+    }
+
+    @Override
+    public void visitStyleSpecifier(IMXMLStyleSpecifierNode node)
+    {
+        debug("visitStyleSpecifier()");
+
+        mxmlEmitter.emitStyleSpecifier(node);
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void visitArray(IMXMLArrayNode node)
+    {
+        debug("visitArray()");
+
+        mxmlEmitter.emitArray(node);
+    }
+
+    @Override
+    public void visitBoolean(IMXMLBooleanNode node)
+    {
+        debug("visitBoolean()");
+
+        mxmlEmitter.emitBoolean(node);
+    }
+
+    @Override
+    public void visitInt(IMXMLIntNode node)
+    {
+        debug("visitInt()");
+
+        mxmlEmitter.emitInt(node);
+    }
+
+    @Override
+    public void visitNumber(IMXMLNumberNode node)
+    {
+        debug("visitNumber()");
+
+        mxmlEmitter.emitNumber(node);
+    }
+
+    @Override
+    public void visitString(IMXMLStringNode node)
+    {
+        debug("visitString()");
+
+        mxmlEmitter.emitString(node);
+    }
+
+    @Override
+    public void visitUint(IMXMLUintNode node)
+    {
+        debug("visitUint()");
+
+        mxmlEmitter.emitUint(node);
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void visitLiteral(IMXMLLiteralNode node)
+    {
+        debug("visitLiteral()");
+
+        mxmlEmitter.emitLiteral(node);
+    }
+
+    //--------------------------------------------------------------------------
+
+    protected void debug(String message)
+    {
+        //System.out.println(message);
+    }
+
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,326 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.mxml;
+
+import java.io.FilterWriter;
+
+import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.internal.codegen.Emitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+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.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;
+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.IBlockWalker;
+import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
+
+/**
+ * The base implementation for an MXML emitter.
+ * 
+ * @author Erik de Bruin
+ */
+public class MXMLEmitter extends Emitter implements IMXMLEmitter
+{
+
+    //--------------------------------------------------------------------------
+    //    walkers
+    //--------------------------------------------------------------------------
+
+    protected IMXMLBlockWalker walker;
+
+    @Override
+    public IBlockWalker getMXMLWalker()
+    {
+        return (IBlockWalker) walker;
+    }
+
+    @Override
+    public void setMXMLWalker(IBlockWalker value)
+    {
+        walker = (IMXMLBlockWalker) value;
+    }
+
+    public MXMLEmitter(FilterWriter out)
+    {
+        super(out);
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void emitDocumentHeader(IMXMLDocumentNode node)
+    {
+        IClassDefinition cdef = node
+                .getClassReference((ICompilerProject) walker.getProject());
+
+        write("<" + cdef.getBaseName());
+
+        emitPropertySpecifiers(node.getPropertySpecifierNodes(), true);
+
+        writeNewline(">", true);
+    }
+
+    @Override
+    public void emitDocumentFooter(IMXMLDocumentNode node)
+    {
+        IClassDefinition cdef = node
+                .getClassReference((ICompilerProject) walker.getProject());
+
+        writeNewline("", false);
+        write("</" + cdef.getBaseName() + ">");
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void emitClass(IMXMLClassDefinitionNode node)
+    {
+
+        // fx:declarations
+        IMXMLDeclarationsNode[] dnodes = node.getDeclarationsNodes();
+        if (dnodes != null)
+        {
+            for (IMXMLDeclarationsNode dnode : dnodes)
+            {
+                getMXMLWalker().walk(dnode);
+            }
+        }
+
+        // fx:script
+        IMXMLScriptNode[] snodes = node.getScriptNodes();
+        if (snodes != null)
+        {
+            for (IMXMLScriptNode snode : snodes)
+            {
+                getMXMLWalker().walk(snode);
+            }
+        }
+
+        // "regular" tags
+        emitPropertySpecifiers(node.getPropertySpecifierNodes(), false);
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void emitEventSpecifier(IMXMLEventSpecifierNode node)
+    {
+    }
+
+    @Override
+    public void emitInstance(IMXMLInstanceNode node)
+    {
+        IClassDefinition cdef = node
+                .getClassReference((ICompilerProject) getMXMLWalker()
+                        .getProject());
+
+        String cname = cdef.getBaseName();
+
+        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
+        emitPropertySpecifiers(pnodes, false);
+
+        write("<");
+        write("/");
+        write(cname);
+        write(">");
+    }
+
+    @Override
+    public void emitPropertySpecifier(IMXMLPropertySpecifierNode node)
+    {
+        if (!isMXMLContentNode(node)) // only for attributes
+        {
+            write(node.getName());
+            write(ASEmitterTokens.EQUAL);
+        }
+
+        getMXMLWalker().walk(node.getInstanceNode());
+    }
+
+    @Override
+    public void emitStyleSpecifier(IMXMLStyleSpecifierNode node)
+    {
+        if (!isMXMLContentNode(node)) // only for attributes
+        {
+            write(node.getName());
+            write(ASEmitterTokens.EQUAL);
+        }
+
+        getMXMLWalker().walk(node.getInstanceNode());
+    }
+
+    @Override
+    public void emitScript(IMXMLScriptNode node)
+    {
+        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>");
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void emitArray(IMXMLArrayNode node)
+    {
+        final int len = node.getChildCount();
+        for (int i = 0; i < len; 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);
+    }
+
+    @Override
+    public void emitInt(IMXMLIntNode node)
+    {
+        emitAttributeValue(node);
+    }
+
+    @Override
+    public void emitNumber(IMXMLNumberNode node)
+    {
+        emitAttributeValue(node);
+    }
+
+    @Override
+    public void emitString(IMXMLStringNode node)
+    {
+        emitAttributeValue(node);
+    }
+
+    @Override
+    public void emitUint(IMXMLUintNode node)
+    {
+        emitAttributeValue(node);
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void emitLiteral(IMXMLLiteralNode node)
+    {
+        write(node.getValue().toString());
+    }
+
+    //--------------------------------------------------------------------------
+    //  utils
+    //--------------------------------------------------------------------------
+
+    public 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)
+    {
+        IMXMLLiteralNode cnode = (IMXMLLiteralNode) node.getChild(0);
+
+        if (cnode.getValue() != null)
+        {
+            write("\"");
+
+            getMXMLWalker().walk((IASNode) cnode); // Literal
+
+            write("\"");
+        }
+    }
+
+    protected boolean isMXMLContentNode(IMXMLNode node)
+    {
+        return node.getName().equals("mxmlContentFactory")
+                || node.getName().equals("mxmlContent");
+    }
+
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitterTokens.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitterTokens.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitterTokens.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitterTokens.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,42 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.mxml;
+
+import org.apache.flex.compiler.codegen.IEmitterTokens;
+
+/**
+ * @author Erik de Bruin
+ */
+public enum MXMLEmitterTokens implements IEmitterTokens
+{
+    TAG_OPEN("<"), TAG_CLOSE(">");
+
+    private String token;
+
+    private MXMLEmitterTokens(String value)
+    {
+        token = value;
+    }
+
+    public String getToken()
+    {
+        return token;
+    }
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSBlockWalker.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSBlockWalker.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSBlockWalker.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSBlockWalker.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,73 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
+
+import java.util.List;
+
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker;
+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
+ * @author Erik de Bruin
+ */
+public class MXMLFlexJSBlockWalker extends MXMLBlockWalker
+{
+
+    private IMXMLEmitter mxmlEmitter;
+
+    public MXMLFlexJSBlockWalker(List<ICompilerProblem> errors,
+            IASProject project, IMXMLEmitter mxmlEmitter, IASEmitter asEmitter,
+            IBlockWalker asBlockWalker)
+    {
+        super(errors, project, mxmlEmitter, asEmitter, asBlockWalker);
+
+        this.mxmlEmitter = mxmlEmitter;
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void visitDocument(IMXMLDocumentNode node)
+    {
+        debug("visitDocument()");
+
+        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
+        }
+
+        mxmlEmitter.emitDocumentFooter(node);
+    }
+
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,167 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
+
+import java.io.FilterWriter;
+
+import org.apache.flex.compiler.codegen.mxml.flexjs.IMXMLFlexJSEmitter;
+import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLEmitter;
+import org.apache.flex.compiler.projects.ICompilerProject;
+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;
+
+/**
+ * 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());
+
+        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);
+        write("<");
+        write(cname);
+        if (node.getID() != null && node.getID() != "")
+        {
+            write(ASEmitterTokens.SPACE);
+            write("id");
+            write(ASEmitterTokens.EQUAL);
+            write("\"");
+            write(node.getID());
+            write("\"");
+        }
+        write(">");
+
+        IMXMLPropertySpecifierNode[] pnodes = node.getPropertySpecifierNodes();
+        if (pnodes != null)
+        {
+            for (IMXMLPropertySpecifierNode pnode : pnodes)
+            {
+                if (!isMXMLContentNode(pnode))
+                    getMXMLWalker().walk(pnode); // Property Specifier
+            }
+        }
+
+        writeNewline("");
+        write("<");
+        write("/");
+        write(cname);
+        writeNewline(">", false);
+    }
+
+    @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() + ">");
+
+        getMXMLWalker().walk(node.getChild(0)); // Array
+
+        write("</" + node.getName() + ">");
+        indentPop();
+    }
+
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void emitArray(IMXMLArrayNode node)
+    {
+        final int len = node.getChildCount();
+        for (int i = 0; i < len; i++)
+        {
+            getMXMLWalker().walk(node.getChild(i)); // Instance
+        }
+    }
+
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/as/ASBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/as/ASBackend.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/as/ASBackend.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/as/ASBackend.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,143 @@
+/*
+ *
+ *  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.driver.as;
+
+import java.io.FilterWriter;
+import java.io.StringWriter;
+import java.util.List;
+
+import org.apache.flex.compiler.codegen.IDocEmitter;
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.as.IASWriter;
+import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.as.ASAfterNodeStrategy;
+import org.apache.flex.compiler.internal.codegen.as.ASBeforeNodeStrategy;
+import org.apache.flex.compiler.internal.codegen.as.ASBlockWalker;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASFilterWriter;
+import org.apache.flex.compiler.internal.codegen.as.ASWriter;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLEmitter;
+import org.apache.flex.compiler.internal.projects.ISourceFileHandler;
+import org.apache.flex.compiler.internal.visitor.as.ASNodeSwitch;
+import org.apache.flex.compiler.internal.visitor.as.BeforeAfterStrategy;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.projects.IASProject;
+import org.apache.flex.compiler.targets.ITarget;
+import org.apache.flex.compiler.targets.ITargetProgressMonitor;
+import org.apache.flex.compiler.targets.ITargetSettings;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.visitor.IBlockWalker;
+import org.apache.flex.compiler.visitor.as.IASBlockWalker;
+import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
+
+/**
+ * A concrete implementation of the {@link IBackend} API where the
+ * {@link ASBlockWalker} is used to traverse the {@link IFileNode} AST.
+ * 
+ * @author Michael Schmalle
+ */
+public class ASBackend implements IBackend
+{
+    @Override
+    public String getOutputExtension()
+    {
+        return "as";
+    }
+
+    @Override
+    public ISourceFileHandler getSourceFileHandlerInstance()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Configurator createConfigurator()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ITarget createTarget(IASProject project, ITargetSettings settings,
+            ITargetProgressMonitor monitor)
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public IASBlockWalker createWalker(IASProject project,
+            List<ICompilerProblem> errors, IASEmitter emitter)
+    {
+        ASBlockWalker walker = new ASBlockWalker(errors, project, emitter);
+
+        BeforeAfterStrategy strategy = new BeforeAfterStrategy(
+                new ASNodeSwitch(walker), new ASBeforeNodeStrategy(emitter),
+                new ASAfterNodeStrategy(emitter));
+
+        walker.setStrategy(strategy);
+
+        return walker;
+    }
+
+    @Override
+    public IMXMLBlockWalker createMXMLWalker(IASProject project,
+            List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+            IASEmitter asEmitter, IBlockWalker asBlockWalker)
+    {
+        return null;
+    }
+
+    @Override
+    public ASFilterWriter createWriterBuffer(IASProject project)
+    {
+        StringWriter out = new StringWriter();
+        ASFilterWriter writer = new ASFilterWriter(out);
+        return writer;
+    }
+
+    @Override
+    public IASEmitter createEmitter(FilterWriter writer)
+    {
+        return new ASEmitter(writer);
+    }
+
+    @Override
+    public IMXMLEmitter createMXMLEmitter(FilterWriter writer)
+    {
+        return new MXMLEmitter(writer);
+    }
+
+    @Override
+    public IASWriter createWriter(IASProject project,
+            List<ICompilerProblem> problems, ICompilationUnit compilationUnit,
+            boolean enableDebug)
+    {
+        return new ASWriter(project, problems, compilationUnit, enableDebug);
+    }
+
+    @Override
+    public IDocEmitter createDocEmitter(IASEmitter emitter)
+    {
+        return null;
+    }
+
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSApplication.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSApplication.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSApplication.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSApplication.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,32 @@
+/*
+ *
+ *  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.driver.js;
+
+import org.apache.flex.compiler.driver.js.IJSApplication;
+
+/**
+ * @author Michael Schmalle
+ */
+public class JSApplication implements IJSApplication
+{
+    public JSApplication()
+    {
+    }
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSBackend.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSBackend.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSBackend.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,146 @@
+/*
+ *
+ *  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.driver.js;
+
+import java.io.FilterWriter;
+import java.io.StringWriter;
+import java.util.List;
+
+import org.apache.flex.compiler.clients.JSConfiguration;
+import org.apache.flex.compiler.codegen.IDocEmitter;
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.codegen.js.IJSWriter;
+import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.as.ASAfterNodeStrategy;
+import org.apache.flex.compiler.internal.codegen.as.ASBeforeNodeStrategy;
+import org.apache.flex.compiler.internal.codegen.as.ASBlockWalker;
+import org.apache.flex.compiler.internal.codegen.js.JSDocEmitter;
+import org.apache.flex.compiler.internal.codegen.js.JSEmitter;
+import org.apache.flex.compiler.internal.codegen.js.JSFilterWriter;
+import org.apache.flex.compiler.internal.codegen.js.JSWriter;
+import org.apache.flex.compiler.internal.projects.ISourceFileHandler;
+import org.apache.flex.compiler.internal.targets.JSTarget;
+import org.apache.flex.compiler.internal.visitor.as.ASNodeSwitch;
+import org.apache.flex.compiler.internal.visitor.as.BeforeAfterStrategy;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.projects.IASProject;
+import org.apache.flex.compiler.targets.ITargetProgressMonitor;
+import org.apache.flex.compiler.targets.ITargetSettings;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.visitor.IBlockWalker;
+import org.apache.flex.compiler.visitor.as.IASBlockWalker;
+import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
+
+/**
+ * A concrete implementation of the {@link IBackend} API where the
+ * {@link ASBlockWalker} is used to traverse the {@link IFileNode} AST.
+ * 
+ * @author Michael Schmalle
+ */
+public class JSBackend implements IBackend
+{
+
+    @Override
+    public String getOutputExtension()
+    {
+        return "js";
+    }
+
+    @Override
+    public ISourceFileHandler getSourceFileHandlerInstance()
+    {
+        return JSSourceFileHandler.INSTANCE;
+    }
+
+    @Override
+    public Configurator createConfigurator()
+    {
+        return new Configurator(JSConfiguration.class);
+    }
+
+    @Override
+    public JSTarget createTarget(IASProject project, ITargetSettings settings,
+            ITargetProgressMonitor monitor)
+    {
+        return new JSTarget(project, settings, monitor);
+    }
+
+    @Override
+    public IASBlockWalker createWalker(IASProject project,
+            List<ICompilerProblem> errors, IASEmitter emitter)
+    {
+        ASBlockWalker walker = new ASBlockWalker(errors, project, emitter);
+
+        BeforeAfterStrategy strategy = new BeforeAfterStrategy(
+                new ASNodeSwitch(walker), new ASBeforeNodeStrategy(emitter),
+                new ASAfterNodeStrategy(emitter));
+
+        walker.setStrategy(strategy);
+
+        return walker;
+    }
+
+    @Override
+    public IMXMLBlockWalker createMXMLWalker(IASProject project,
+            List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+            IASEmitter asEmitter, IBlockWalker asBlockWalker)
+    {
+        return null;
+    }
+
+    @Override
+    public JSFilterWriter createWriterBuffer(IASProject project)
+    {
+        StringWriter out = new StringWriter();
+        JSFilterWriter writer = new JSFilterWriter(out);
+        return writer;
+    }
+
+    @Override
+    public IJSWriter createWriter(IASProject project,
+            List<ICompilerProblem> problems, ICompilationUnit compilationUnit,
+            boolean enableDebug)
+    {
+        return new JSWriter(project, problems, compilationUnit, enableDebug);
+    }
+
+    @Override
+    public IDocEmitter createDocEmitter(IASEmitter emitter)
+    {
+        return new JSDocEmitter((IJSEmitter) emitter);
+    }
+
+    @Override
+    public IASEmitter createEmitter(FilterWriter out)
+    {
+        return new JSEmitter(out);
+    }
+
+    @Override
+    public IMXMLEmitter createMXMLEmitter(FilterWriter out)
+    {
+        return null;
+    }
+
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSCompilationUnit.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSCompilationUnit.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSCompilationUnit.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSCompilationUnit.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,217 @@
+/*
+ *
+ *  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.driver.js;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.apache.flex.compiler.common.DependencyType;
+import org.apache.flex.compiler.internal.projects.CompilerProject;
+import org.apache.flex.compiler.internal.projects.DefinitionPriority;
+import org.apache.flex.compiler.internal.units.ASCompilationUnit;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.targets.ITarget.TargetType;
+import org.apache.flex.compiler.units.requests.IOutgoingDependenciesRequestResult;
+
+/**
+ * JSCompilationUnit is the CompilationUnit for compiling ActionScript source
+ * files to JavasScript.
+ * <p>
+ * JSCompilationUnit is derived from ASCompilationUnit and overrides the parts
+ * that generate the code.
+ */
+public class JSCompilationUnit extends ASCompilationUnit
+{
+    @SuppressWarnings("unused")
+    private Boolean inCodeGen = false;
+
+    /**
+     * Create a compilation unit from an ABC file.
+     * 
+     * @param project compiler project
+     * @param path ABC file path
+     * @throws IOException error
+     */
+    public JSCompilationUnit(CompilerProject project, String path)
+            throws IOException
+    {
+        this(project, path, DefinitionPriority.BasePriority.LIBRARY_PATH);
+    }
+
+    public JSCompilationUnit(CompilerProject project, String path,
+            DefinitionPriority.BasePriority basePriority)
+    {
+        super(project, path, basePriority);
+    }
+
+    public JSCompilationUnit(CompilerProject project, String path,
+            DefinitionPriority.BasePriority basePriority, String qname)
+    {
+        super(project, path, basePriority, 0, qname);
+    }
+
+    //    protected IABCBytesRequestResult _handleABCBytesRequest(Operation buildPhase) throws InterruptedException
+    //    {
+    //        // If JSEmitter.needsSecondPass() returns true, JSGenerator.generate() will return null during scanning, 
+    //        // which will result in JSCompilationUnit::handleSemanticProblemsRequest not caching any abcBytes for 
+    //        // handleABCBytesRequest. The net result is that JSGenerator.generate() will be called again in handleABCBytesRequest. 
+    //        // This mechanic will ensure selective two-pass compilation. 
+    //        if (m_abcBytes != null &&
+    //            !JSSharedData.instance.hasSymbols() && // Symbol support
+    //            !JSSharedData.instance.hasAnyClassInit()) // support for class inits 
+    //            return m_abcBytes;
+    //
+    //        JSGenerator jsGenerator = new JSGenerator();
+    //        jsGenerator.m_compilationUnit = this;
+    //        jsGenerator.setBuildPhase(buildPhase);
+    //
+    //        // Need to force the file scope request to happen first to get the ASFileScope
+    //        // for this compilation unit registered with the project.
+    //        // ** TODO this is a hack!
+    //        getFileScopeRequest().get();
+    //
+    //        // This is also a hack!  If there are embed directives, need to ensure
+    //        // semantic pass has finished, as that is what will generate the embed classes
+    //        // which are needed by codegen
+    //        if (buildPhase != Operation.GET_SEMANTIC_PROBLEMS)
+    //        {
+    //        	// AJH this was deadlocking as getOutgoingDependencies calls handleABCBytes
+    //        	if (buildPhase != Operation.GET_ABC_BYTES)
+    //        		getOutgoingDependenciesRequest().get();
+    //        }
+    //
+    //        final ISyntaxTreeRequestResult fsr = getSyntaxTreeRequest().get();
+    //        final IASNode rootNode = fsr.getAST();
+    //
+    //        startProfile(buildPhase);
+    //        IABCBytesRequestResult result = jsGenerator.generate(getFilenameNoPath(), rootNode, this.getProject());
+    //        stopProfile(buildPhase);
+    //
+    //        m_needsSecondPass = jsGenerator.needsSecondPass();
+    //
+    //        return result;
+    //    }
+
+    //   @Override
+    //    protected IABCBytesRequestResult handleABCBytesRequest() throws InterruptedException
+    //    {
+    //        final IABCBytesRequestResult result = _handleABCBytesRequest(Operation.GET_ABC_BYTES);
+    //
+    //        /*
+    //         * // explicitly reference all classes this class depends on if(
+    //         * result.getProblems() == null || result.getProblems().length == 0 ) {
+    //         * final String code = new String( result.getABCBytes() ); if(
+    //         * code.contains(JSSharedData.REQUIRED_TAG_MARKER) ) { final
+    //         * ICompilationUnit cu = this; final Set<ICompilationUnit> deps = new
+    //         * HashSet<ICompilationUnit>(); deps.addAll(
+    //         * getProject().getDependencies(cu) ); if( !deps.isEmpty() ) { String
+    //         * depNames = ""; Boolean separator = false; final List<IDefinition>
+    //         * defs = MXMLJSC.getClassDefinitions( cu ); for( IDefinition def: defs
+    //         * ) { if( def instanceof ClassDefinition ) { final String defName =
+    //         * JSGeneratingReducer.createFullNameFromDefinition(def); if( defName !=
+    //         * null && !defName.isEmpty() ) { if( separator ) depNames += ":"; else
+    //         * separator = true; depNames += defName; } } }
+    //         * code.replaceFirst(JSSharedData.REQUIRED_TAG_MARKER, depNames); return
+    //         * new ABCBytesRequestResult(code.getBytes(), result.getProblems()); } }
+    //         * }
+    //         */
+    //        return result;
+    //    }
+
+    @Override
+    protected IOutgoingDependenciesRequestResult handleOutgoingDependenciesRequest()
+            throws InterruptedException
+    {
+        //        // Every CU is dependent on the class glue, which is implemented in browser.adobe.
+        //        // Add dependency from this JSCompilationUnit to browser.adobe's JSCompilationUnit.
+        //        addDependency(JSSharedData.JS_FRAMEWORK_NAME, DependencyType.INHERITANCE);
+        //        addDependency(JSSharedData.FRAMEWORK_CLASS, DependencyType.INHERITANCE);
+
+        IOutgoingDependenciesRequestResult result = super
+                .handleOutgoingDependenciesRequest();
+
+        //        // SWFTarget::startBuildAndFindAllCompilationUnits() is called by SWFTarget::collectProblems(), which is called by SWFTarget::addToSWF() in JSDriver::main().
+        //        // This is our first pass. jsGenerator.generate() will return null if JSGeneratingReducer.getMember 
+        //        // If JSEmitter.needsSecondPass() returns true, JSGenerator.generate() will return null during scanning, 
+        //        // which will result in JSCompilationUnit::handleSemanticProblemsRequest not caching any abcBytes for 
+        //        // handleABCBytesRequest. The net result is that JSGenerator.generate() will be called again in handleABCBytesRequest. 
+        //        // This mechanic will ensure selective two-pass compilation. 
+        //        if (result.getProblems().length == 0)
+        //        {
+        //            m_needsSecondPass = false;
+        //            m_abcBytes = _handleABCBytesRequest(Operation.GET_SEMANTIC_PROBLEMS);
+        //            if (m_needsSecondPass)
+        //                m_abcBytes = null;
+        //        }
+
+        return result;
+    }
+
+    public Boolean addDependency(String className, DependencyType dt)
+    {
+        //        if (JSGeneratingReducer.isReservedDataType(className))
+        //            return false;
+        //
+        //        final ICompilationUnit fromCU = this;
+        //        final CompilerProject compilerProject = this.getProject();
+        //        final ASProjectScope projectScope = compilerProject.getScope();
+        //
+        //        final IDefinition classDef = projectScope.findDefinitionByName(className);
+        //        if (classDef == null)
+        //            return false;
+        //
+        //        final ICompilationUnit toCU = projectScope.getCompilationUnitForDefinition(classDef);
+        //        if (fromCU == toCU)
+        //            return false;
+        //
+        //        // sharedData.verboseMessage( "Adding dependency: " + className );
+        //        compilerProject.addDependency(fromCU, toCU, dt);
+
+        return true;
+    }
+
+    @Override
+    public void startBuildAsync(TargetType targetType)
+    {
+        // super.startBuildAsync(targetType);
+
+        getSyntaxTreeRequest();
+        getFileScopeRequest();
+        getOutgoingDependenciesRequest();
+
+        //        // scanning and code generating phases need to be separated
+        //        // in order to create two distinct passes for m_needSecondPass.
+        //        if (m_inCodeGen)
+        //        {
+        //            getABCBytesRequest();
+        //            getSWFTagsRequest();
+        //        }
+    }
+
+    @Override
+    public void waitForBuildFinish(final Collection<ICompilerProblem> problems,
+            TargetType targetType) throws InterruptedException
+    {
+        inCodeGen = true;
+        super.waitForBuildFinish(problems, targetType);
+        inCodeGen = false;
+    }
+
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSSourceFileHandler.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSSourceFileHandler.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSSourceFileHandler.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/JSSourceFileHandler.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,83 @@
+/*
+ *
+ *  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.driver.js;
+
+import org.apache.flex.compiler.internal.projects.CompilerProject;
+import org.apache.flex.compiler.internal.projects.DefinitionPriority;
+import org.apache.flex.compiler.internal.projects.ISourceFileHandler;
+import org.apache.flex.compiler.internal.units.ASCompilationUnit;
+import org.apache.flex.compiler.units.ICompilationUnit;
+
+/**
+ * Implementation of ISourceFileHandler that constructs
+ * {@link ASCompilationUnit}'s. JSSourceFileHandler is the SourceFileHandler
+ * that provides JSCompilationUnit for *.as files. JSDriver registers
+ * JSSourceFileHandler at FlexApplicationProject. This implementation is part of
+ * FalconJS. For more details on FalconJS see org.apache.flex.compiler.JSDriver
+ */
+public final class JSSourceFileHandler implements ISourceFileHandler
+{
+
+    public static final String EXTENSION = "as"; //$NON-NLS-1$
+    public static final JSSourceFileHandler INSTANCE = new JSSourceFileHandler();
+
+    private JSSourceFileHandler()
+    {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String[] getExtensions()
+    {
+        return new String[] { EXTENSION };
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ICompilationUnit createCompilationUnit(CompilerProject proj,
+            String path, DefinitionPriority.BasePriority basePriority,
+            int order, String qname, String locale)
+    {
+        return new JSCompilationUnit(proj, path, basePriority, qname);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean needCompilationUnit(CompilerProject project, String path,
+            String qname, String locale)
+    {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean canCreateInvisibleCompilationUnit()
+    {
+        return false;
+    }
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/amd/AMDBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/amd/AMDBackend.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/amd/AMDBackend.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/amd/AMDBackend.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,53 @@
+/*
+ *
+ *  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.driver.js.amd;
+
+import java.io.FilterWriter;
+
+import org.apache.flex.compiler.codegen.IDocEmitter;
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.js.amd.JSAMDDocEmitter;
+import org.apache.flex.compiler.internal.codegen.js.amd.JSAMDEmitter;
+import org.apache.flex.compiler.internal.driver.js.JSBackend;
+
+/**
+ * A concrete implementation of the {@link IBackend} API for 'AMD' code
+ * production.
+ * 
+ * @author Michael Schmalle
+ */
+public class AMDBackend extends JSBackend
+{
+    @Override
+    public IDocEmitter createDocEmitter(IASEmitter emitter)
+    {
+        return new JSAMDDocEmitter((IJSEmitter) emitter);
+    }
+
+    @Override
+    public IJSEmitter createEmitter(FilterWriter out)
+    {
+        IJSEmitter emitter = new JSAMDEmitter(out);
+        emitter.setDocEmitter(createDocEmitter(emitter));
+        return emitter;
+    }
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/GoogBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/GoogBackend.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/GoogBackend.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/GoogBackend.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,61 @@
+/*
+ *
+ *  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.driver.js.goog;
+
+import java.io.FilterWriter;
+
+import org.apache.flex.compiler.codegen.IDocEmitter;
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogDocEmitter;
+import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitter;
+import org.apache.flex.compiler.internal.driver.js.JSBackend;
+
+/**
+ * A concrete implementation of the {@link IBackend} API for the 'goog' code
+ * production.
+ * 
+ * @author Michael Schmalle
+ */
+public class GoogBackend extends JSBackend
+{
+
+    @Override
+    public Configurator createConfigurator()
+    {
+        return new Configurator(JSGoogConfiguration.class);
+    }
+
+    @Override
+    public IDocEmitter createDocEmitter(IASEmitter emitter)
+    {
+        return new JSGoogDocEmitter((IJSEmitter) emitter);
+    }
+
+    @Override
+    public IJSEmitter createEmitter(FilterWriter out)
+    {
+        IJSEmitter emitter = new JSGoogEmitter(out);
+        emitter.setDocEmitter(createDocEmitter(emitter));
+        return emitter;
+    }
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,84 @@
+/*
+ *
+ *  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.driver.js.goog;
+
+import org.apache.flex.compiler.clients.JSConfiguration;
+import org.apache.flex.compiler.clients.MXMLJSC;
+import org.apache.flex.compiler.config.ConfigurationValue;
+import org.apache.flex.compiler.exceptions.ConfigurationException;
+import org.apache.flex.compiler.internal.config.annotations.Config;
+import org.apache.flex.compiler.internal.config.annotations.Mapping;
+
+/**
+ * The {@link JSGoogConfiguration} class holds all compiler arguments needed for
+ * compiling ActionScript to JavaScript the 'goog' way.
+ * <p>
+ * Specific flags are implemented here for the configuration to be loaded by the
+ * configure() method of {@link MXMLJSC}.
+ * <p>
+ * This class inherits all compiler arguments from the MXMLC compiler.
+ * 
+ * @author Erik de Bruin
+ */
+public class JSGoogConfiguration extends JSConfiguration
+{
+    public JSGoogConfiguration()
+    {
+    }
+
+    //
+    // 'closure-lib'
+    //
+
+    private String closureLib;
+
+    public String getClosureLib()
+    {
+        return closureLib;
+    }
+
+    @Config
+    @Mapping("closure-lib")
+    public void setClosureLib(ConfigurationValue cv, String value)
+            throws ConfigurationException
+    {
+        closureLib = value;
+    }
+
+    //
+    // 'vanilla-sdk-lib'
+    //
+
+    private String vanillaSDKLib;
+
+    public String getVanillaSDKLib()
+    {
+        return vanillaSDKLib;
+    }
+
+    @Config
+    @Mapping("vanilla-sdk-lib")
+    public void setVanillaSDKLib(ConfigurationValue cv, String value)
+            throws ConfigurationException
+    {
+        vanillaSDKLib = value;
+    }
+
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/MXMLBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/MXMLBackend.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/MXMLBackend.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/MXMLBackend.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,80 @@
+/*
+ *
+ *  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.driver.mxml;
+
+import java.io.FilterWriter;
+import java.util.List;
+
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLEmitter;
+import org.apache.flex.compiler.internal.driver.js.JSBackend;
+import org.apache.flex.compiler.internal.projects.ISourceFileHandler;
+import org.apache.flex.compiler.internal.visitor.as.ASNodeSwitch;
+import org.apache.flex.compiler.internal.visitor.mxml.MXMLNodeSwitch;
+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.mxml.IMXMLBlockWalker;
+
+/**
+ * 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 MXMLBackend extends JSBackend
+{
+
+    @Override
+    public ISourceFileHandler getSourceFileHandlerInstance()
+    {
+        return MXMLSourceFileHandler.INSTANCE;
+    }
+
+    @Override
+    public IMXMLEmitter createMXMLEmitter(FilterWriter out)
+    {
+        return new MXMLEmitter(out);
+    }
+
+    @Override
+    public IMXMLBlockWalker createMXMLWalker(IASProject project,
+            List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+            IASEmitter asEmitter, IBlockWalker asBlockWalker)
+    {
+        MXMLBlockWalker walker = new MXMLBlockWalker(errors, project,
+                mxmlEmitter, asEmitter, asBlockWalker);
+
+        ASNodeSwitch asStrategy = new ASNodeSwitch(
+                (IBlockVisitor) asBlockWalker);
+        walker.setASStrategy(asStrategy);
+
+        MXMLNodeSwitch strategy = new MXMLNodeSwitch(walker);
+        walker.setMXMLStrategy(strategy);
+
+        return walker;
+    }
+
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/MXMLSourceFileHandler.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/MXMLSourceFileHandler.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/MXMLSourceFileHandler.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/MXMLSourceFileHandler.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,85 @@
+/*
+ *
+ *  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.driver.mxml;
+
+import org.apache.flex.compiler.internal.driver.js.JSCompilationUnit;
+import org.apache.flex.compiler.internal.projects.CompilerProject;
+import org.apache.flex.compiler.internal.projects.DefinitionPriority;
+import org.apache.flex.compiler.internal.projects.ISourceFileHandler;
+import org.apache.flex.compiler.internal.units.ASCompilationUnit;
+import org.apache.flex.compiler.units.ICompilationUnit;
+
+/**
+ * Implementation of ISourceFileHandler that constructs
+ * {@link ASCompilationUnit}'s. MXMLSourceFileHandler is the SourceFileHandler
+ * that provides JSCompilationUnit for *.mxml files. JSDriver registers
+ * MXMLSourceFileHandler at FlexApplicationProject. This implementation is part
+ * of FalconJS. For more details on FalconJS see
+ * org.apache.flex.compiler.JSDriver
+ */
+public final class MXMLSourceFileHandler implements ISourceFileHandler
+{
+
+    public static final String EXTENSION = "mxml"; //$NON-NLS-1$
+    public static final MXMLSourceFileHandler INSTANCE = new MXMLSourceFileHandler();
+
+    private MXMLSourceFileHandler()
+    {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String[] getExtensions()
+    {
+        return new String[] { EXTENSION };
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ICompilationUnit createCompilationUnit(CompilerProject proj,
+            String path, DefinitionPriority.BasePriority basePriority,
+            int order, String qname, String locale)
+    {
+        return new JSCompilationUnit(proj, path, basePriority, qname);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean needCompilationUnit(CompilerProject project, String path,
+            String qname, String locale)
+    {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean canCreateInvisibleCompilationUnit()
+    {
+        return false;
+    }
+}

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

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/flexjs/MXMLFlexJSBackend.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/flexjs/MXMLFlexJSBackend.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/flexjs/MXMLFlexJSBackend.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/flexjs/MXMLFlexJSBackend.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,74 @@
+/*
+ *
+ *  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.driver.mxml.flexjs;
+
+import java.io.FilterWriter;
+import java.util.List;
+
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker;
+import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSBlockWalker;
+import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitter;
+import org.apache.flex.compiler.internal.driver.mxml.MXMLBackend;
+import org.apache.flex.compiler.internal.visitor.as.ASNodeSwitch;
+import org.apache.flex.compiler.internal.visitor.mxml.MXMLNodeSwitch;
+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.mxml.IMXMLBlockWalker;
+
+/**
+ * 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);
+    }
+
+    @Override
+    public IMXMLBlockWalker createMXMLWalker(IASProject project,
+            List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+            IASEmitter asEmitter, IBlockWalker asBlockWalker)
+    {
+        MXMLBlockWalker walker = new MXMLFlexJSBlockWalker(errors, project,
+                mxmlEmitter, asEmitter, asBlockWalker);
+
+        ASNodeSwitch asStrategy = new ASNodeSwitch(
+                (IBlockVisitor) asBlockWalker);
+        walker.setASStrategy(asStrategy);
+
+        MXMLNodeSwitch mxmlStrategy = new MXMLNodeSwitch(walker);
+        walker.setMXMLStrategy(mxmlStrategy);
+
+        return walker;
+    }
+
+}

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

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/targets/JSTarget.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/targets/JSTarget.java?rev=1452955&r1=1452954&r2=1452955&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/targets/JSTarget.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/targets/JSTarget.java Tue Mar  5 19:22:05 2013
@@ -25,11 +25,11 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.flex.compiler.driver.js.IJSApplication;
 import org.apache.flex.compiler.exceptions.BuildCanceledException;
-import org.apache.flex.compiler.internal.js.codegen.JSSharedData;
-import org.apache.flex.compiler.internal.js.driver.JSApplication;
+import org.apache.flex.compiler.internal.codegen.js.JSSharedData;
+import org.apache.flex.compiler.internal.driver.js.JSApplication;
 import org.apache.flex.compiler.internal.projects.CompilerProject;
-import org.apache.flex.compiler.js.IJSApplication;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.IASProject;
 import org.apache.flex.compiler.targets.IJSTarget;

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeHandler.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeHandler.java?rev=1452955&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeHandler.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeHandler.java Tue Mar  5 19:22:05 2013
@@ -0,0 +1,87 @@
+/*
+ *
+ *  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.visitor.as;
+
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.visitor.IASNodeStrategy;
+
+/**
+ * A concrete implementation of the {@link IASNodeStrategy} that allows a
+ * subclass to either implement the {@link IASNode} handling directly or pass a
+ * child {@link IASNodeStrategy} that this class will delegate it's
+ * {@link #handle(IASNode)} method to.
+ * 
+ * @author Michael Schmalle
+ * 
+ * @see BeforeAfterStrategy
+ */
+public class ASNodeHandler implements IASNodeStrategy
+{
+    private IASNodeStrategy handler;
+
+    /**
+     * Returns the {@link IASNodeStrategy} currently being used to handle
+     * {@link IASNode} AST.
+     * 
+     * @return The current strategy.
+     */
+    public IASNodeStrategy getHandler()
+    {
+        return handler;
+    }
+
+    /**
+     * Sets the {@link IASNode} handler strategy.
+     * 
+     * @param handler The {@link IASNodeStrategy} to handle the specific
+     * {@link IASNode}.
+     */
+    public void setHandler(IASNodeStrategy handler)
+    {
+        this.handler = handler;
+    }
+
+    /**
+     * Constructor, used when this handler directly implements
+     * {@link #handle(IASNode)} and does not composite a child
+     * {@link IASNodeStrategy}.
+     */
+    public ASNodeHandler()
+    {
+    }
+
+    /**
+     * Constructor, creates a node strategy that composites a child
+     * {@link IASNodeStrategy} implemented in the {@link #handle(IASNode)}
+     * method.
+     * 
+     * @param handler The {@link IASNode} handler to be used in this strategy.
+     */
+    public ASNodeHandler(IASNodeStrategy handler)
+    {
+        this.handler = handler;
+    }
+
+    @Override
+    public void handle(IASNode node)
+    {
+        handler.handle(node);
+    }
+}

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



Mime
View raw message