incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1426489 [4/4] - in /incubator/flex/whiteboard/mschmalle/falconjx: compiler.jx.tests/src/org/apache/flex/compiler/ compiler.jx.tests/src/org/apache/flex/compiler/internal/ compiler.jx.tests/src/org/apache/flex/compiler/internal/as/ compiler...
Date Fri, 28 Dec 2012 12:59:01 GMT
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogDocEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogDocEmitter.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogDocEmitter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogDocEmitter.java Fri Dec 28 12:59:00 2012
@@ -0,0 +1,158 @@
+package org.apache.flex.compiler.internal.js.codegen.goog;
+
+import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.definitions.ITypeDefinition;
+import org.apache.flex.compiler.internal.js.codegen.JSDocEmitter;
+import org.apache.flex.compiler.internal.js.codegen.JSSharedData;
+import org.apache.flex.compiler.js.codegen.IJSEmitter;
+import org.apache.flex.compiler.js.codegen.goog.IJSGoogDocEmitter;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IClassNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IPackageNode;
+import org.apache.flex.compiler.tree.as.IParameterNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+
+public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
+{
+
+    public JSGoogDocEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+        // TODO Auto-generated constructor stub
+    }
+    
+
+    @Override
+    public void emitConst(IVariableNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void emitConstructor(IFunctionNode node)
+    {
+        write(" * @constructor\n");
+    }
+
+    @Override
+    public void emitDefine(IVariableNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void emitDeprecated(IASNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void emitEnum(IClassNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void emitExtends(IClassDefinition superDefinition)
+    {
+        final String qname = superDefinition.getQualifiedName();
+        // TODO (mschmalle) test Object is this the only class that dosn't need a tag?
+        if (qname.equals("Object"))
+            return;
+        write(" * @extends {" + qname + "}\n");
+    }
+
+    @Override
+    public void emitImplements(IClassNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void emitInheritDoc(IClassNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void emitLicense(IClassNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void emitOverride(IFunctionNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void emitParam(IParameterNode node)
+    {
+        write(" * @param {" + node.getVariableType() + "} " + node.getName()
+                + "\n");
+    }
+
+    @Override
+    public void emitPrivate(IASNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void emitProtected(IASNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void emitReturn(IFunctionNode node)
+    {
+        // TODO convert js types
+        String rtype = node.getReturnType();
+        if (rtype != null)
+            write(" * @return {" + rtype + "}\n");
+    }
+
+    @Override
+    public void emitThis(ITypeDefinition type)
+    {
+        write(" * @this {" + type.getQualifiedName() + "}\n");
+    }
+
+    @Override
+    public void emitType(IASNode node)
+    {
+        //String type = SemanticUtils.getTypeOfStem(node, emitter.getProject());
+        String type = ((IVariableNode) node).getVariableType(); // XXX need to map to js types
+        write(" * @type {" + type + "}\n");
+    }
+
+    @Override
+    public void emitTypedef(IASNode node)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    //--------------------------------------------------------------------------
+
+    public void emmitPackageHeader(IPackageNode node)
+    {
+        begin();
+        write(" * " + JSSharedData.getTimeStampString());
+        end();
+    }
+
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogDocEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogEmitter.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogEmitter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogEmitter.java Fri Dec 28 12:59:00 2012
@@ -0,0 +1,449 @@
+/*
+ *
+ *  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.js.codegen.goog;
+
+import java.io.FilterWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.definitions.IPackageDefinition;
+import org.apache.flex.compiler.definitions.ITypeDefinition;
+import org.apache.flex.compiler.internal.js.codegen.JSEmitter;
+import org.apache.flex.compiler.internal.js.codegen.JSSharedData;
+import org.apache.flex.compiler.internal.tree.as.FunctionNode;
+import org.apache.flex.compiler.js.codegen.goog.IJSGoogDocEmitter;
+import org.apache.flex.compiler.js.codegen.goog.IJSGoogEmitter;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.tree.as.IClassNode;
+import org.apache.flex.compiler.tree.as.IDefinitionNode;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IPackageNode;
+import org.apache.flex.compiler.tree.as.IParameterNode;
+import org.apache.flex.compiler.tree.as.IScopedNode;
+import org.apache.flex.compiler.tree.as.ITypeNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+
+/**
+ * Concrete implementation of the 'goog' JavaScript production.
+ * 
+ * @author Michael Schmalle
+ */
+public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
+{
+    IJSGoogDocEmitter getDoc()
+    {
+        return (IJSGoogDocEmitter) getDocEmitter();
+    }
+
+    //--------------------------------------------------------------------------
+    // 
+    //--------------------------------------------------------------------------
+
+    public void emitJSDocPackgeHeader(IPackageNode node)
+    {
+        //        getDocEmitter().emmitPackageHeader(node);
+    }
+
+    @Override
+    public void emitJSDocVariable(IVariableNode node)
+    {
+        getDoc().begin();
+        getDoc().emitType(node);
+        getDoc().end();
+    }
+
+    @Override
+    public void emitJSDocConstructor(IFunctionNode node,
+            ICompilerProject project)
+    {
+        IClassDefinition parent = (IClassDefinition) node.getDefinition()
+                .getParent();
+        IClassDefinition superClass = parent.resolveBaseClass(project);
+
+        getDoc().begin();
+        getDoc().emitConstructor(node);
+        if (superClass != null)
+            getDoc().emitExtends(superClass);
+        getDoc().end();
+    }
+
+    //--------------------------------------------------------------------------
+    // 
+    //--------------------------------------------------------------------------
+
+    @Override
+    public void emitPackageHeader(IPackageNode node)
+    {
+        ITypeNode type = findTypeNode(node);
+        if (type == null)
+            return;
+
+        write("goog.provide('" + type.getQualifiedName() + "');");
+        write("\n");
+        write("\n");
+    }
+
+    @Override
+    public void emitPackageHeaderContents(IPackageNode node)
+    {
+        ITypeNode type = findTypeNode(node);
+        if (type == null)
+            return;
+
+        IPackageDefinition parent = (IPackageDefinition) node.getDefinition();
+        ArrayList<String> list = new ArrayList<String>();
+        parent.getContainedScope().getScopeNode().getAllImports(list);
+        for (String imp : list)
+        {
+            if (imp.indexOf("__AS3__") != -1)
+                continue;
+            write("goog.require('" + imp + "');");
+            write("\n");
+        }
+        write("\n");
+    }
+
+    @Override
+    public void emitPackageContents(IPackageNode node)
+    {
+        ITypeNode type = findTypeNode(node);
+        if (type == null)
+            return;
+
+        IClassNode cnode = (IClassNode) type;
+        IClassDefinition definition = cnode.getDefinition();
+
+        // constructor
+        emitConstructor((IFunctionNode) definition.getConstructor().getNode());
+        write(";\n");
+        write("\n");
+
+        IDefinitionNode[] members = cnode.getAllMemberNodes();
+        for (IDefinitionNode dnode : members)
+        {
+            if (dnode instanceof IVariableNode)
+            {
+                emitField((IVariableNode) dnode);
+                write(";\n");
+                write("\n");
+            }
+        }
+
+        for (IDefinitionNode dnode : members)
+        {
+            if (dnode instanceof IFunctionNode)
+            {
+                if (!((IFunctionNode) dnode).isConstructor())
+                {
+                    emitMethod((IFunctionNode) dnode);
+                    write(";\n");
+                    write("\n");
+                }
+            }
+        }
+    }
+
+    @Override
+    public void emitPackageFooter(IPackageNode node)
+    {
+    }
+
+    @Override
+    public void emitConstructor(IFunctionNode node)
+    {
+        IClassDefinition definition = getClassDefinition(node);
+
+        FunctionNode fn = (FunctionNode) node;
+        fn.parseFunctionBody(new ArrayList<ICompilerProblem>());
+
+        emitJSDocConstructor(node, getWalker().getProject());
+
+        String qname = definition.getQualifiedName();
+        write(qname);
+        write(" ");
+        write("=");
+        write(" ");
+        write("function");
+        emitParamters(node.getParameterNodes());
+        emitMethodScope(node.getScopedNode());
+    }
+
+    @Override
+    public void emitField(IVariableNode node)
+    {
+        IClassDefinition definition = getClassDefinition(node);
+
+        emitJSDocVariable(node);
+        write(definition.getQualifiedName() + ".prototype." + node.getName());
+        IExpressionNode vnode = node.getAssignedValueNode();
+        if (vnode != null)
+        {
+            write(" = ");
+            getWalker().walk(vnode);
+        }
+    }
+
+    @Override
+    public void emitJSDoc(IFunctionNode node, ICompilerProject project,
+            boolean isConstructor, ITypeDefinition type)
+    {
+        // TODO (mschmalle) change method signature, remove type
+        // this is a temp override until I change the method signature
+        // unit testing dosn't have access to the type, we need to use the AST to get the definition
+        if (type == null)
+        {
+            ITypeNode tnode = (ITypeNode) node
+                    .getAncestorOfType(ITypeNode.class);
+            type = (ITypeDefinition) tnode.getDefinition();
+        }
+
+        if (node instanceof IFunctionNode)
+        {
+            if (isConstructor)
+            {
+                emitJSDocConstructor(node, project);
+            }
+            else
+            {
+                getDoc().begin();
+                getDoc().emitThis(type);
+                // @param
+                IParameterNode[] parameters = node.getParameterNodes();
+                for (IParameterNode pnode : parameters)
+                {
+                    getDoc().emitParam(pnode);
+                }
+                // @return
+                getDoc().emitReturn(node);
+                getDoc().end();
+            }
+        }
+    }
+
+    @Override
+    public void emitMethod(IFunctionNode node)
+    {
+        if (node.isConstructor())
+            return;
+
+        IClassDefinition definition = getClassDefinition(node);
+
+        emitJSDoc(node, getWalker().getProject(), false, definition);
+        FunctionNode fn = (FunctionNode) node;
+        fn.parseFunctionBody(new ArrayList<ICompilerProblem>());
+
+        String qname = getTypeDefinition(node).getQualifiedName();
+        if (qname != null && !qname.equals(""))
+        {
+            write(qname);
+            write(".");
+        }
+
+        emitMemberName(node);
+        write(" ");
+        write("=");
+        write(" ");
+        write("function");
+        emitParamters(node.getParameterNodes());
+        emitMethodScope(node.getScopedNode());
+    }
+
+    @Override
+    public void emitFunctionBlockHeader(IFunctionNode node)
+    {
+        if (JSSharedData.OUTPUT_ALTERNATE)
+        {
+            emitDefaultParameterCodeBlock_Alternate(node);
+        }
+        else
+        {
+            emitDefaultParameterCodeBlock(node);
+        }
+    }
+
+    private void emitDefaultParameterCodeBlock(IFunctionNode node)
+    {
+        // TODO (mschmalle) test for ... rest 
+        // if default parameters exist, produce the init code
+        IParameterNode[] pnodes = node.getParameterNodes();
+        Map<Integer, IParameterNode> defaults = getDefaults(pnodes);
+        if (pnodes.length == 0)
+            return;
+
+        final StringBuilder code = new StringBuilder();
+        if (defaults != null)
+        {
+            List<IParameterNode> parameters = new ArrayList<IParameterNode>(
+                    defaults.values());
+            Collections.reverse(parameters);
+
+            int len = defaults.size();
+            int numDefaults = 0;
+            // make the header in reverse order
+            for (IParameterNode pnode : parameters)
+            {
+                if (pnode != null)
+                {
+                    code.append(getIndent(numDefaults));
+                    code.append("if (arguments.length < " + len + ") {\n");
+                    numDefaults++;
+                }
+                len--;
+            }
+
+            Collections.reverse(parameters);
+            for (IParameterNode pnode : parameters)
+            {
+                if (pnode != null)
+                {
+                    code.append(getIndent(numDefaults));
+                    code.append(pnode.getName());
+                    code.append(" = ");
+                    code.append(pnode.getDefaultValue());
+                    code.append(";\n");
+                    code.append(getIndent(numDefaults - 1));
+                    code.append("}");
+                    if (numDefaults > 1)
+                        code.append("\n");
+                    numDefaults--;
+                }
+            }
+            IScopedNode sbn = node.getScopedNode();
+            boolean hasBody = sbn.getChildCount() > 0;
+            // adds the current block indent to the generated code
+            String indent = getIndent(getCurrentIndent() + (!hasBody ? 1 : 0));
+            String result = code.toString().replaceAll("\n", "\n" + indent);
+            // if the block dosn't have a body (children), need to add indent to head
+            if (!hasBody)
+                result = indent + result;
+            // have to add newline after the replace or we get an extra indent
+            result += "\n";
+            write(result);
+        }
+    }
+
+    private void emitDefaultParameterCodeBlock_Alternate(IFunctionNode node)
+    {
+        // (erikdebruin) implemented alternative approach to handling 
+        //               default parameter values in JS
+
+        IParameterNode[] pnodes = node.getParameterNodes();
+
+        Map<Integer, IParameterNode> defaults = getDefaults(pnodes);
+
+        if (!hasBody(node))
+        {
+            indentPush();
+            write("\t");
+        }
+
+        final StringBuilder code = new StringBuilder();
+
+        if (defaults != null)
+        {
+            List<IParameterNode> parameters = new ArrayList<IParameterNode>(
+                    defaults.values());
+
+            int numDefaults = 0;
+            for (IParameterNode pnode : parameters)
+            {
+                if (pnode != null)
+                {
+                    if (numDefaults > 0)
+                        code.append(getIndent(getCurrentIndent()));
+
+                    code.append(pnode.getName() + " = typeof "
+                            + pnode.getName() + " !== 'undefined' ? "
+                            + pnode.getName() + " : " + pnode.getDefaultValue()
+                            + ";\n");
+
+                    numDefaults++;
+                }
+            }
+
+            if (!hasBody(node))
+                indentPop();
+
+            write(code.toString());
+        }
+    }
+
+    @Override
+    public void emitParameter(IParameterNode node)
+    {
+        // only the name gets output in JS
+        getWalker().walk(node.getNameExpressionNode());
+    }
+
+    public JSGoogEmitter(FilterWriter out)
+    {
+        super(out);
+    }
+
+    private Map<Integer, IParameterNode> getDefaults(IParameterNode[] nodes)
+    {
+        Map<Integer, IParameterNode> result = new HashMap<Integer, IParameterNode>();
+        int i = 0;
+        boolean hasDefaults = false;
+        for (IParameterNode node : nodes)
+        {
+            if (node.hasDefaultValue())
+            {
+                hasDefaults = true;
+                result.put(i, node);
+            }
+            else
+            {
+                result.put(i, null);
+            }
+            i++;
+        }
+
+        if (!hasDefaults)
+            return null;
+
+        return result;
+    }
+
+    private static ITypeDefinition getTypeDefinition(IDefinitionNode node)
+    {
+        ITypeNode tnode = (ITypeNode) node.getAncestorOfType(ITypeNode.class);
+        return (ITypeDefinition) tnode.getDefinition();
+    }
+
+    private static IClassDefinition getClassDefinition(IDefinitionNode node)
+    {
+        IClassNode tnode = (IClassNode) node
+                .getAncestorOfType(IClassNode.class);
+        return tnode.getDefinition();
+    }
+
+    private static boolean hasBody(IFunctionNode node)
+    {
+        IScopedNode scope = node.getScopedNode();
+        return scope.getChildCount() > 0;
+    }
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codegen/goog/JSGoogEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSApplication.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSApplication.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSApplication.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSApplication.java Fri Dec 28 12:59:00 2012
@@ -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.js.driver;
+
+import org.apache.flex.compiler.js.IJSApplication;
+
+/**
+ * @author Michael Schmalle
+ */
+public class JSApplication implements IJSApplication
+{
+    public JSApplication()
+    {
+    }
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSApplication.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java Fri Dec 28 12:59:00 2012
@@ -0,0 +1,130 @@
+/*
+ *
+ *  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.js.driver;
+
+import java.io.FilterWriter;
+import java.io.StringWriter;
+import java.util.List;
+
+import org.apache.flex.compiler.as.codegen.IASEmitter;
+import org.apache.flex.compiler.as.codegen.IDocEmitter;
+import org.apache.flex.compiler.clients.IBackend;
+import org.apache.flex.compiler.clients.JSConfiguration;
+import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.internal.as.codegen.ASBlockWalker;
+import org.apache.flex.compiler.internal.as.codegen.ASFilterWriter;
+import org.apache.flex.compiler.internal.as.codegen.ASAfterNodeStrategy;
+import org.apache.flex.compiler.internal.as.codegen.ASBeforeNodeStrategy;
+import org.apache.flex.compiler.internal.as.visitor.ASNodeSwitch;
+import org.apache.flex.compiler.internal.as.visitor.BeforeAfterStrategy;
+import org.apache.flex.compiler.internal.js.codegen.JSDocEmitter;
+import org.apache.flex.compiler.internal.js.codegen.JSEmitter;
+import org.apache.flex.compiler.internal.js.codegen.JSFilterWriter;
+import org.apache.flex.compiler.internal.js.codegen.JSWriter;
+import org.apache.flex.compiler.internal.projects.ISourceFileHandler;
+import org.apache.flex.compiler.internal.targets.JSTarget;
+import org.apache.flex.compiler.js.codegen.IJSEmitter;
+import org.apache.flex.compiler.js.codegen.IJSWriter;
+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.IASBlockWalker;
+
+/**
+ * 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, ASFilterWriter out)
+    {
+        IJSEmitter emitter = createEmitter(out);
+        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 JSFilterWriter createFilterWriter(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);
+    }
+
+    protected IJSEmitter createEmitter(FilterWriter out)
+    {
+        return new JSEmitter(out);
+    }
+
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSBackend.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSCompilationUnit.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSCompilationUnit.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSCompilationUnit.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSCompilationUnit.java Fri Dec 28 12:59:00 2012
@@ -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.js.driver;
+
+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: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSCompilationUnit.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSSourceFileHandler.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSSourceFileHandler.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSSourceFileHandler.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSSourceFileHandler.java Fri Dec 28 12:59:00 2012
@@ -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.js.driver;
+
+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: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/JSSourceFileHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/goog/GoogBackend.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/goog/GoogBackend.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/goog/GoogBackend.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/goog/GoogBackend.java Fri Dec 28 12:59:00 2012
@@ -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.js.driver.goog;
+
+import java.io.FilterWriter;
+
+import org.apache.flex.compiler.as.codegen.IASEmitter;
+import org.apache.flex.compiler.as.codegen.IDocEmitter;
+import org.apache.flex.compiler.clients.IBackend;
+import org.apache.flex.compiler.internal.js.codegen.goog.JSGoogDocEmitter;
+import org.apache.flex.compiler.internal.js.codegen.goog.JSGoogEmitter;
+import org.apache.flex.compiler.internal.js.driver.JSBackend;
+import org.apache.flex.compiler.js.codegen.IJSEmitter;
+
+/**
+ * A concrete implementation of the {@link IBackend} API for the 'goog' code
+ * production.
+ * 
+ * @author Michael Schmalle
+ */
+public class GoogBackend extends JSBackend
+{
+    @Override
+    public IDocEmitter createDocEmitter(IASEmitter emitter)
+    {
+        return new JSGoogDocEmitter((IJSEmitter) emitter);
+    }
+
+    @Override
+    protected IJSEmitter createEmitter(FilterWriter out)
+    {
+        IJSEmitter emitter = new JSGoogEmitter(out);
+        emitter.setDocEmitter(createDocEmitter(emitter));
+        return emitter;
+    }
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/driver/goog/GoogBackend.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/targets/JSTarget.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/targets/JSTarget.java?rev=1426489&r1=1426488&r2=1426489&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/targets/JSTarget.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/targets/JSTarget.java Fri Dec 28 12:59:00 2012
@@ -26,8 +26,8 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.flex.compiler.exceptions.BuildCanceledException;
-import org.apache.flex.compiler.internal.driver.JSApplication;
-import org.apache.flex.compiler.internal.js.codgen.JSSharedData;
+import org.apache.flex.compiler.internal.js.codegen.JSSharedData;
+import org.apache.flex.compiler.internal.js.driver.JSApplication;
 import org.apache.flex.compiler.internal.projects.CompilerProject;
 import org.apache.flex.compiler.js.IJSApplication;
 import org.apache.flex.compiler.problems.ICompilerProblem;

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSDocEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSDocEmitter.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSDocEmitter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSDocEmitter.java Fri Dec 28 12:59:00 2012
@@ -0,0 +1,33 @@
+/*
+ *
+ *  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.js.codegen;
+
+import org.apache.flex.compiler.as.codegen.IDocEmitter;
+
+/**
+ * The {@link IJSDocEmitter} interface allows the abstraction of JavaScript
+ * document comments to be emitted per tag.
+ * 
+ * @author Michael Schmalle
+ */
+public interface IJSDocEmitter extends IDocEmitter
+{
+
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSDocEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSEmitter.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSEmitter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSEmitter.java Fri Dec 28 12:59:00 2012
@@ -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.js.codegen;
+
+import java.io.Writer;
+
+import org.apache.flex.compiler.as.codegen.IASEmitter;
+import org.apache.flex.compiler.visitor.IASNodeStrategy;
+
+/**
+ * The {@link IJSEmitter} interface allows abstraction between the
+ * {@link IASNodeStrategy} and the current output buffer {@link Writer}.
+ * 
+ * @author Michael Schmalle
+ */
+public interface IJSEmitter extends IASEmitter
+{
+
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSWriter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSWriter.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSWriter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSWriter.java Fri Dec 28 12:59:00 2012
@@ -0,0 +1,33 @@
+/*
+ *
+ *  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.js.codegen;
+
+import org.apache.flex.compiler.as.codegen.IASWriter;
+
+/**
+ * A JavaScript writer that outputs cross compiled string data to the
+ * output stream.
+ * 
+ * @author Michael Schmalle
+ */
+public interface IJSWriter extends IASWriter
+{
+
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/IJSWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/goog/IJSGoogDocEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/goog/IJSGoogDocEmitter.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/goog/IJSGoogDocEmitter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/goog/IJSGoogDocEmitter.java Fri Dec 28 12:59:00 2012
@@ -0,0 +1,140 @@
+/*
+ *
+ *  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.js.codegen.goog;
+
+import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.definitions.ITypeDefinition;
+import org.apache.flex.compiler.js.codegen.IJSDocEmitter;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IClassNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IParameterNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+
+/**
+ * The {@link IJSGoogDocEmitter} interface allows the abstraction of JavaScript
+ * document comments to be emitted per tag.
+ * <p>
+ * The purpose of the API is to clamp emitted output to JavaScript doc tags. The
+ * output can be multiline but is specific to one tag. This allows a full
+ * comment to be created without worrying about how to assemble the tags.
+ * <p>
+ * The current tags were found at
+ * https://developers.google.com/closure/compiler/docs/js-for-compiler#types
+ * <p>
+ * TODO (mschmalle) Might make a comment API and tag API so comments are not
+ * dependent on tag creation IE IJSDocEmitter and IJSDocTagEmitter
+ * 
+ * @author Michael Schmalle
+ */
+public interface IJSGoogDocEmitter extends IJSDocEmitter
+{
+    /*
+     * https://developers.google.com/closure/compiler/docs/js-for-compiler#types
+     *- @const - Marks a variable as read-only. The compiler can inline @const variables
+     *
+     *- @constructor - Marks a function as a constructor.
+     *
+     *- @define - Indicates a constant that can be overridden by the compiler at compile-time.
+     *
+     * @deprecated - Warns against using the marked function, method, or property should not be used.
+     * 
+     *- @enum - Specifies the type of an enum. An enum is an object whose properties constitute a 
+     *        set of related constants. The @enum tag must be followed by a type expression. 
+     *        
+     * @expose - Declares an exposed property. Exposed properties will not be removed, or renamed, 
+     *         or collapsed, or optimized in any way by the compiler.
+     *         
+     *- @extends - Marks a class or interface as inheriting from another class. A class marked 
+     *           with @extends must also be marked with either @constructor or @interface. 
+     *           
+     *- @implements - Used with @constructor to indicate that a class implements an interface. 
+     *
+     *- @inheritDoc - tag implies the @override tag.  has exactly the same documentation.
+     *
+     * @interface - Marks a function as an interface.
+     * 
+     * @lends
+     * 
+     * @license|@preserve - Tells the compiler to insert the associated comment before the compiled
+     *                      code for the marked file.
+     *                      
+     * @nosideeffects - Indicates that a call to the declared function has no side effects
+     * 
+     *- @override - Indicates that a method or property of a subclass intentionally hides a method or 
+     *              property of the superclass.
+     *              
+     * @param - Used with method, function and constructor definitions to specify the types of function 
+     *          arguments. 
+     *          
+     * @private - Marks a member as private. Only code in the same file can access global variables and 
+     *            functions marked @private. Constructors marked @private can only be instantiated by code 
+     *            in the same file and by their static and instance members. 
+     *            
+     * @protected - Indicates that a member or property is protected.
+     * 
+     * @return - Specifies the return types of method and function definitions. The @return tag must be 
+     *           followed by a type expression. 
+     *           
+     * @this - Specifies the type of the object to which the keyword this refers within a function. 
+     *         The @this tag must be followed by a type expression. 
+     *         
+     * @type - Identifies the type of a variable, property, or expression. The @type tag must be 
+     *         followed by a type expression. 
+     *         
+     * @typedef - Declares an alias for a more complex type. 
+     */
+
+    // @const
+
+    void emitConst(IVariableNode node);
+
+    void emitConstructor(IFunctionNode node);
+
+    void emitDefine(IVariableNode node);
+
+    void emitDeprecated(IASNode node);
+
+    void emitEnum(IClassNode node);
+
+    void emitExtends(IClassDefinition superDefinition);
+
+    void emitImplements(IClassNode node);
+
+    void emitInheritDoc(IClassNode node);
+
+    void emitLicense(IClassNode node);
+
+    void emitOverride(IFunctionNode node);
+
+    void emitParam(IParameterNode node);
+
+    void emitPrivate(IASNode node);
+
+    void emitProtected(IASNode node);
+
+    void emitReturn(IFunctionNode node);
+
+    void emitThis(ITypeDefinition node);
+
+    void emitType(IASNode node);
+
+    void emitTypedef(IASNode node);
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/goog/IJSGoogDocEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/goog/IJSGoogEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/goog/IJSGoogEmitter.java?rev=1426489&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/goog/IJSGoogEmitter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/goog/IJSGoogEmitter.java Fri Dec 28 12:59:00 2012
@@ -0,0 +1,33 @@
+/*
+ *
+ *  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.js.codegen.goog;
+
+import org.apache.flex.compiler.js.codegen.IJSEmitter;
+
+/**
+ * The {@link IJSGoogEmitter} interface allows abstraction between the base
+ * JavaScript and the 'goog' specific IJSGoogEmitter.
+ * 
+ * @author Michael Schmalle
+ */
+public interface IJSGoogEmitter extends IJSEmitter
+{
+
+}

Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/codegen/goog/IJSGoogEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java?rev=1426489&r1=1426488&r2=1426489&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockVisitor.java Fri Dec 28 12:59:00 2012
@@ -19,10 +19,10 @@
 
 package org.apache.flex.compiler.visitor;
 
-import org.apache.flex.compiler.internal.js.codgen.ASBlockWalker;
+import org.apache.flex.compiler.internal.as.codegen.ASBlockWalker;
+import org.apache.flex.compiler.internal.as.visitor.ASNodeSwitch;
 import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
 import org.apache.flex.compiler.internal.tree.as.NamespaceAccessExpressionNode;
-import org.apache.flex.compiler.internal.visitor.ASNodeSwitch;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IBlockNode;



Mime
View raw message