You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ms...@apache.org on 2012/12/17 23:24:20 UTC
svn commit: r1423195 - in /incubator/flex/whiteboard/mschmalle/falconjx:
compiler.jx.tests/src/org/apache/flex/js/internal/driver/
compiler.jx/src/org/apache/flex/as/
compiler.jx/src/org/apache/flex/compiler/clients/
compiler.jx/src/org/apache/flex/com...
Author: mschmalle
Date: Mon Dec 17 22:24:16 2012
New Revision: 1423195
URL: http://svn.apache.org/viewvc?rev=1423195&view=rev
Log:
Flex:FalconJx
- Moved js package into compiler
- pulled methods out of JSEmitter into ASEmitter
- added TestFieldMembers for class field and constant tests
Added:
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestFieldMembers.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/as/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/as/IASEmitter.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSApplication.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSDocEmitter.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSEmitter.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSWriter.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java (with props)
Removed:
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/
Modified:
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSApplication.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/AfterNodeStrategy.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeNodeStrategy.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/ASBlockWalker.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSDocEmitter.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSEmitter.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSWriter.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/targets/JSTarget.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/targets/IJSTarget.java
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestFieldMembers.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestFieldMembers.java?rev=1423195&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestFieldMembers.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestFieldMembers.java Mon Dec 17 22:24:16 2012
@@ -0,0 +1,169 @@
+/*
+ *
+ * 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.js.internal.driver;
+
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.junit.Test;
+
+/**
+ * This class tests the production of valid ActionScript3 code for Class Field
+ * members.
+ *
+ * @author Michael Schmalle
+ */
+public class TestFieldMembers extends TestWalkerBase
+{
+ /*
+ * Field, Constant, Namespace
+ *
+ * - config block
+ *
+ * var foo;
+ * var foo:int;
+ * var foo:int = 42;
+ * private var foo:int;
+ * private var foo:int = 42;
+ * protected var foo:int;
+ * public var foo:int;
+ */
+
+ //--------------------------------------------------------------------------
+ // Field
+ //--------------------------------------------------------------------------
+
+ @Test
+ public void testField()
+ {
+ IVariableNode node = getField("var foo;");
+ visitor.visitVariable(node);
+ assertOut("var foo:*");
+ }
+
+ @Test
+ public void testField_withType()
+ {
+ IVariableNode node = getField("var foo:int;");
+ visitor.visitVariable(node);
+ assertOut("var foo:int");
+ }
+
+ @Test
+ public void testField_withTypeValue()
+ {
+ IVariableNode node = getField("var foo:int = 420;");
+ visitor.visitVariable(node);
+ assertOut("var foo:int = 420");
+ }
+
+ @Test
+ public void testField_withNamespaceTypeValue()
+ {
+ IVariableNode node = getField("private var foo:int = 420;");
+ visitor.visitVariable(node);
+ assertOut("private var foo:int = 420");
+ }
+
+ @Test
+ public void testField_withCustomNamespaceTypeValue()
+ {
+ IVariableNode node = getField("mx_internal var foo:int = 420;");
+ visitor.visitVariable(node);
+ assertOut("mx_internal var foo:int = 420");
+ }
+
+ @Test
+ public void testField_withNamespaceTypeCollection()
+ {
+ IVariableNode node = getField("protected var foo:Vector.<Foo>;");
+ visitor.visitVariable(node);
+ assertOut("protected var foo:Vector.<Foo>");
+ }
+
+ @Test
+ public void testField_withNamespaceTypeCollectionComplex()
+ {
+ IVariableNode node = getField("protected var foo:Vector.<Vector.<Vector.<Foo>>>;");
+ visitor.visitVariable(node);
+ assertOut("protected var foo:Vector.<Vector.<Vector.<Foo>>>");
+ }
+
+ @Test
+ public void testField_withNamespaceTypeValueComplex()
+ {
+ IVariableNode node = getField("protected var foo:Foo = new Foo('bar', 42);");
+ visitor.visitVariable(node);
+ assertOut("protected var foo:Foo = new Foo('bar', 42)");
+ }
+
+ //--------------------------------------------------------------------------
+ // Constant
+ //--------------------------------------------------------------------------
+
+ @Test
+ public void testConstant()
+ {
+ IVariableNode node = getField("static const foo;");
+ visitor.visitVariable(node);
+ // TODO (mschmalle) is * type even possible for a constant?
+ assertOut("static const foo:*");
+ }
+
+ @Test
+ public void testConstant_withType()
+ {
+ IVariableNode node = getField("static const foo:int;");
+ visitor.visitVariable(node);
+ assertOut("static const foo:int");
+ }
+
+ @Test
+ public void testConstant_withTypeValue()
+ {
+ IVariableNode node = getField("static const foo:int = 420;");
+ visitor.visitVariable(node);
+ assertOut("static const foo:int = 420");
+ }
+
+ @Test
+ public void testConstant_withNamespaceTypeValue()
+ {
+ IVariableNode node = getField("private static const foo:int = 420;");
+ visitor.visitVariable(node);
+ assertOut("private static const foo:int = 420");
+ }
+
+ @Test
+ public void testConstant_withCustomNamespaceTypeValue()
+ {
+ IVariableNode node = getField("mx_internal static const foo:int = 420;");
+ visitor.visitVariable(node);
+ assertOut("mx_internal static const foo:int = 420");
+ }
+
+ protected IVariableNode getField(String code)
+ {
+ String source = "package {public class A {" + code + "}}";
+ IFileNode node = getFileNode(source);
+ IVariableNode child = (IVariableNode) findFirstDescendantOfType(node,
+ IVariableNode.class);
+ return child;
+ }
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestFieldMembers.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/as/IASEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/as/IASEmitter.java?rev=1423195&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/as/IASEmitter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/as/IASEmitter.java Mon Dec 17 22:24:16 2012
@@ -0,0 +1,67 @@
+/*
+ *
+ * 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.as;
+
+import java.io.Writer;
+
+import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.apache.flex.compiler.visitor.IASNodeStrategy;
+
+/**
+ * The {@link IASEmitter} interface allows abstraction between the
+ * {@link IASNodeStrategy} and the current output buffer {@link Writer}.
+ *
+ * @author Michael Schmalle
+ */
+public interface IASEmitter
+{
+ /**
+ * Writes a string to the writer.
+ *
+ * @param value The string to write to the output buffer.
+ */
+ void write(String value);
+
+ /**
+ * Pushes an indent into the emitter so after newlines are emitted, the
+ * output is correctly formatted.
+ */
+ void indentPush();
+
+ /**
+ * Pops an indent from the emitter so after newlines are emitted, the
+ * output is correctly formatted.
+ */
+ void indentPop();
+
+ /**
+ * Emit a documentation comment for a Class field {@link IVariableNode}.
+ *
+ * @param node The {@link IVariableNode} class field member.
+ */
+ void emitDocumentation(IVariableNode node);
+
+ /**
+ * Emit a full Class field member.
+ *
+ * @param node The {@link IVariableNode} class field member.
+ */
+ void emitField(IVariableNode node);
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/as/IASEmitter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java?rev=1423195&r1=1423194&r2=1423195&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java Mon Dec 17 22:24:16 2012
@@ -54,6 +54,7 @@ import org.apache.flex.compiler.internal
import org.apache.flex.compiler.internal.units.ResourceModuleCompilationUnit;
import org.apache.flex.compiler.internal.units.SourceCompilationUnitFactory;
import org.apache.flex.compiler.internal.workspaces.Workspace;
+import org.apache.flex.compiler.js.IJSApplication;
import org.apache.flex.compiler.problems.ConfigurationProblem;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.InternalCompilerProblem;
@@ -62,7 +63,6 @@ import org.apache.flex.compiler.problems
import org.apache.flex.compiler.projects.ICompilerProject;
import org.apache.flex.compiler.targets.ITargetSettings;
import org.apache.flex.compiler.units.ICompilationUnit;
-import org.apache.flex.js.IJSApplication;
import org.apache.flex.utils.FileUtils;
import org.apache.flex.utils.FilenameNormalization;
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java?rev=1423195&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java Mon Dec 17 22:24:16 2012
@@ -0,0 +1,188 @@
+/*
+ *
+ * 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.as.codegen;
+
+import java.io.FilterWriter;
+import java.io.IOException;
+
+import org.apache.flex.as.IASEmitter;
+import org.apache.flex.compiler.common.ASModifier;
+import org.apache.flex.compiler.common.ModifiersSet;
+import org.apache.flex.compiler.definitions.IVariableDefinition;
+import org.apache.flex.compiler.definitions.references.INamespaceReference;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.apache.flex.compiler.visitor.IASBlockWalker;
+
+/**
+ * The base implementation for an ActionScript emitter.
+ *
+ * @author Michael Schmalle
+ */
+public class ASEmitter implements IASEmitter
+{
+ protected static final String NL = "\n";
+
+ protected static final String INDENT_STRING = "\t";
+
+ private final FilterWriter out;
+
+ private int currentIndent = 0;
+
+ private IASBlockWalker visitor;
+
+ public IASBlockWalker getVisitor()
+ {
+ return visitor;
+ }
+
+ public void setVisitor(IASBlockWalker value)
+ {
+ visitor = value;
+ }
+
+ public ASEmitter(FilterWriter out)
+ {
+ this.out = out;
+ }
+
+ @Override
+ public void write(String value)
+ {
+ try
+ {
+ out.write(value);
+
+ String indent = "";
+ if (value.indexOf(NL) != -1)
+ {
+ // TODO (mschmalle) is StringBuilder faster?
+ for (int i = 0; i < currentIndent; i++)
+ indent += INDENT_STRING;
+
+ out.write(indent);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void indentPush()
+ {
+ currentIndent++;
+ }
+
+ @Override
+ public void indentPop()
+ {
+ currentIndent--;
+ }
+
+ public void writeIndent()
+ {
+ String indent = "";
+ for (int i = 0; i < currentIndent; i++)
+ indent += INDENT_STRING;
+ write(indent);
+ }
+
+ public void writeNewline()
+ {
+ write(NL);
+ }
+
+ public void writeToken(String value)
+ {
+ write(value);
+ }
+
+ public void writeSymbol(String value)
+ {
+ write(value);
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ //--------------------------------------------------------------------------
+
+ @Override
+ public void emitField(IVariableNode node)
+ {
+ emitDocumentation(node);
+
+ IVariableDefinition definition = (IVariableDefinition) node
+ .getDefinition();
+
+ // namespace (public, protected, private, foo_bar)
+ // TODO (mschmalle) figure out what to do if there is an explicit internal
+ // right now if it's internal, code not produced (implied)
+ if (!definition.isInternal())
+ {
+ INamespaceReference reference = definition.getNamespaceReference();
+ write(reference.getBaseName());
+ write(" ");
+ }
+
+ // madofiers (static)
+ ModifiersSet modifierSet = definition.getModifiers();
+ if (modifierSet.hasModifiers())
+ {
+ for (ASModifier modifier : modifierSet.getAllModifiers())
+ {
+ write(modifier.toString());
+ write(" ");
+ }
+ }
+
+ // keyword
+ write(node.isConst() ? "const" : "var");
+ write(" ");
+ // name
+ getVisitor().walk(node.getNameExpressionNode());
+
+ // type
+ IExpressionNode tnode = node.getVariableTypeNode();
+ // TODO (mschmalle) node.getVariableTypeNode() will return "*" if undefined, what to use?
+ if (tnode != null)
+ {
+ write(":");
+ getVisitor().walk(tnode);
+ }
+
+ // assigned value
+ IExpressionNode vnode = node.getAssignedValueNode();
+ if (vnode != null)
+ {
+ write(" ");
+ write("=");
+ write(" ");
+ getVisitor().walk(vnode);
+ }
+ // the client such as IASBlockWalker is responsible for the
+ // semi-colon and newline handling
+ }
+
+ public void emitDocumentation(IVariableNode node)
+ {
+ }
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSApplication.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSApplication.java?rev=1423195&r1=1423194&r2=1423195&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSApplication.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSApplication.java Mon Dec 17 22:24:16 2012
@@ -19,7 +19,7 @@
package org.apache.flex.compiler.internal.driver;
-import org.apache.flex.js.IJSApplication;
+import org.apache.flex.compiler.js.IJSApplication;
public class JSApplication implements IJSApplication
{
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/AfterNodeStrategy.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/AfterNodeStrategy.java?rev=1423195&r1=1423194&r2=1423195&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/AfterNodeStrategy.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/AfterNodeStrategy.java Mon Dec 17 22:24:16 2012
@@ -19,12 +19,12 @@
package org.apache.flex.compiler.internal.driver.strategy;
+import org.apache.flex.compiler.js.IJSEmitter;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.tree.as.IContainerNode;
import org.apache.flex.compiler.tree.as.IContainerNode.ContainerType;
import org.apache.flex.compiler.visitor.IASNodeStrategy;
-import org.apache.flex.js.IJSEmitter;
/**
* A concrete implementation of the {@link IASNodeStrategy} that allows
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeNodeStrategy.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeNodeStrategy.java?rev=1423195&r1=1423194&r2=1423195&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeNodeStrategy.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeNodeStrategy.java Mon Dec 17 22:24:16 2012
@@ -19,12 +19,12 @@
package org.apache.flex.compiler.internal.driver.strategy;
+import org.apache.flex.compiler.js.IJSEmitter;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.tree.as.IContainerNode;
import org.apache.flex.compiler.tree.as.IContainerNode.ContainerType;
import org.apache.flex.compiler.visitor.IASNodeStrategy;
-import org.apache.flex.js.IJSEmitter;
/**
* A concrete implementation of the {@link IASNodeStrategy} that allows
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/ASBlockWalker.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/ASBlockWalker.java?rev=1423195&r1=1423194&r2=1423195&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/ASBlockWalker.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/ASBlockWalker.java Mon Dec 17 22:24:16 2012
@@ -26,8 +26,10 @@ import java.util.Stack;
import org.apache.flex.compiler.definitions.IClassDefinition;
import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.definitions.IInterfaceDefinition;
import org.apache.flex.compiler.definitions.ITypeDefinition;
import org.apache.flex.compiler.definitions.IVariableDefinition;
+import org.apache.flex.compiler.internal.semantics.SemanticUtils;
import org.apache.flex.compiler.internal.tree.as.BaseLiteralContainerNode;
import org.apache.flex.compiler.internal.tree.as.ContainerNode;
import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
@@ -92,6 +94,7 @@ import org.apache.flex.compiler.tree.met
import org.apache.flex.compiler.tree.metadata.IMetaTagsNode;
import org.apache.flex.compiler.units.ICompilationUnit;
import org.apache.flex.compiler.visitor.IASBlockVisitor;
+import org.apache.flex.compiler.visitor.IASBlockWalker;
import org.apache.flex.compiler.visitor.IASNodeStrategy;
/**
@@ -100,7 +103,7 @@ import org.apache.flex.compiler.visitor.
*
* @author Michael Schmalle
*/
-public class ASBlockWalker implements IASBlockVisitor
+public class ASBlockWalker implements IASBlockVisitor, IASBlockWalker
{
/**
* The context stack of the visitor.
@@ -188,11 +191,21 @@ public class ASBlockWalker implements IA
private String classQualifiedName;
- private IClassDefinition classDefinition;
+ private ITypeDefinition typeDefinition;
public ITypeDefinition getCurrentType()
{
- return classDefinition;
+ return typeDefinition;
+ }
+
+ public IClassDefinition getCurrentClass()
+ {
+ return (IClassDefinition) typeDefinition;
+ }
+
+ public IInterfaceDefinition getCurrentInterface()
+ {
+ return (IInterfaceDefinition) typeDefinition;
}
//----------------------------------
@@ -256,13 +269,13 @@ public class ASBlockWalker implements IA
@Override
public void visitClass(IClassNode node)
{
- classDefinition = node.getDefinition();
- classQualifiedName = classDefinition.getQualifiedName();
+ typeDefinition = node.getDefinition();
+ classQualifiedName = typeDefinition.getQualifiedName();
debug("visitClass()");
pushContext(TraverseContext.TYPE);
- emitter.emitProvide(classDefinition);
- emitter.emitRequire(classDefinition);
+ emitter.emitProvide(typeDefinition);
+ emitter.emitRequire(typeDefinition);
// fields, methods, namespaces
final IDefinitionNode[] members = node.getAllMemberNodes();
@@ -272,14 +285,14 @@ public class ASBlockWalker implements IA
// TODO (mschmalle) handle null constructor
}
- emitter.emitConstructor(currentConstructor);
- emitter.emitInherits(classDefinition, project);
+// emitter.emitConstructor(currentConstructor);
+// emitter.emitInherits(typeDefinition, project);
emitter.emitFields(members);
emitter.emitMethods(members);
popContext(TraverseContext.TYPE);
- classDefinition = null;
+ typeDefinition = null;
currentConstructor = null;
}
@@ -304,10 +317,12 @@ public class ASBlockWalker implements IA
public void visitVariable(IVariableNode node)
{
debug("visitVariable()");
- if (inContext(TraverseContext.FIELD))
+ // inContext(TraverseContext.FIELD)
+
+ if (SemanticUtils.isMemberDefinition(node.getDefinition()))
{
- if (node.hasNamespace("private"))
- return;
+ //if (node.hasNamespace("private"))
+ // return;
emitter.emitField(node);
}
@@ -327,7 +342,7 @@ public class ASBlockWalker implements IA
if (!inContext(TraverseContext.FUNCTION))
{
emitter.emitJSDoc(node, project, node == currentConstructor,
- classDefinition);
+ typeDefinition);
String key = "";
if (node instanceof IGetterNode)
key = "get_";
@@ -1024,7 +1039,9 @@ public class ASBlockWalker implements IA
{
debug("visitITypedExpression()");
walk(node.getCollectionNode());
+ emitter.write(".<");
walk(node.getTypeNode());
+ emitter.write(">");
}
@Override
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSDocEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSDocEmitter.java?rev=1423195&r1=1423194&r2=1423195&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSDocEmitter.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSDocEmitter.java Mon Dec 17 22:24:16 2012
@@ -21,13 +21,13 @@ package org.apache.flex.compiler.interna
import org.apache.flex.compiler.definitions.IClassDefinition;
import org.apache.flex.compiler.definitions.ITypeDefinition;
+import org.apache.flex.compiler.js.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.IPackageNode;
import org.apache.flex.compiler.tree.as.IParameterNode;
import org.apache.flex.compiler.tree.as.IVariableNode;
-import org.apache.flex.js.IJSDocEmitter;
public class JSDocEmitter implements IJSDocEmitter
{
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSEmitter.java?rev=1423195&r1=1423194&r2=1423195&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSEmitter.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSEmitter.java Mon Dec 17 22:24:16 2012
@@ -19,14 +19,15 @@
package org.apache.flex.compiler.internal.js.codgen;
-import java.io.IOException;
+import java.io.FilterWriter;
import java.util.ArrayList;
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.codgen.ASBlockWalker.TraverseContext;
+import org.apache.flex.compiler.internal.as.codegen.ASEmitter;
import org.apache.flex.compiler.internal.tree.as.FunctionObjectNode;
+import org.apache.flex.compiler.js.IJSEmitter;
import org.apache.flex.compiler.projects.IASProject;
import org.apache.flex.compiler.projects.ICompilerProject;
import org.apache.flex.compiler.tree.as.IAccessorNode;
@@ -37,85 +38,27 @@ import org.apache.flex.compiler.tree.as.
import org.apache.flex.compiler.tree.as.IPackageNode;
import org.apache.flex.compiler.tree.as.IParameterNode;
import org.apache.flex.compiler.tree.as.IVariableNode;
-import org.apache.flex.js.IJSEmitter;
/**
* @author Michael Schmalle
*/
-public class JSEmitter implements IJSEmitter
+public class JSEmitter extends ASEmitter implements IJSEmitter
{
- private static final String NL = "\n";
-
- private static final String INDENT_STRING = "\t";
-
public static boolean javascriptMode = false;
- private final JSFilterWriter out;
-
- private ASBlockWalker visitor;
-
- private int currentIndent = 0;
-
private JSDocEmitter jsdoc;
- public ASBlockWalker getVisitor()
- {
- return visitor;
- }
-
- public void setVisitor(ASBlockWalker value)
- {
- visitor = value;
- }
-
public ICompilerProject getProject()
{
return getVisitor().getProject();
}
- public JSEmitter(JSFilterWriter out)
+ public JSEmitter(FilterWriter out)
{
- this.out = out;
+ super(out);
this.jsdoc = new JSDocEmitter(this);
}
- void writeNewline()
- {
- write(NL);
- }
-
- void writeToken(String value)
- {
- write(value);
- }
-
- void writeSymbol(String value)
- {
- write(value);
- }
-
- @Override
- public void write(String value)
- {
- try
- {
- out.write(value);
-
- String indent = "";
- if (value.indexOf(NL) != -1)
- {
- for (int i = 0; i < currentIndent; i++)
- indent += INDENT_STRING;
-
- out.write(indent);
- }
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
-
public void emitJSDocPackgeHeader(IPackageNode node)
{
jsdoc.emmitPackageHeader(node);
@@ -211,7 +154,7 @@ public class JSEmitter implements IJSEmi
public void emitFields(IDefinitionNode[] members)
{
- getVisitor().pushContext(TraverseContext.FIELD);
+ //getVisitor().pushContext(TraverseContext.FIELD);
for (IDefinitionNode node : members)
{
if (node instanceof IVariableNode
@@ -220,60 +163,43 @@ public class JSEmitter implements IJSEmi
getVisitor().walk(node);
}
}
- getVisitor().popContext(TraverseContext.FIELD);
+ //getVisitor().popContext(TraverseContext.FIELD);
}
public void emitMethods(IDefinitionNode[] members)
{
- getVisitor().pushContext(TraverseContext.METHOD);
+ //getVisitor().pushContext(TraverseContext.METHOD);
for (IDefinitionNode node : members)
{
if (node instanceof IFunctionNode)
{
- if (node != getVisitor().getCurrentConstructor())
+ if (node != getVisitor().getCurrentClass().getConstructor())
getVisitor().walk(node);
}
}
- getVisitor().popContext(TraverseContext.METHOD);
- }
-
- public void indentPush()
- {
- currentIndent++;
- }
-
- public void indentPop()
- {
- currentIndent--;
- }
-
- public void writeIndent()
- {
- String indent = "";
- for (int i = 0; i < currentIndent; i++)
- indent += INDENT_STRING;
- write(indent);
+ //getVisitor().popContext(TraverseContext.METHOD);
}
public void emitField(IVariableNode node)
{
- emitJSDocVariable(node);
- write(getVisitor().getCurrentType().getQualifiedName() + ".prototype."
- + node.getName());
- IExpressionNode vnode = node.getAssignedValueNode();
- if (vnode != null)
- {
- write(" = ");
- getVisitor().walk(vnode);
- }
- write(";\n");
+ super.emitField(node);
+ // emitJSDocVariable(node);
+ // write(getVisitor().getCurrentType().getQualifiedName() + ".prototype."
+ // + node.getName());
+ // IExpressionNode vnode = node.getAssignedValueNode();
+ // if (vnode != null)
+ // {
+ // write(" = ");
+ // getVisitor().walk(vnode);
+ // }
+ // write(";\n");
}
public void emitVarDeclaration(IVariableNode node)
{
- visitor.walk(node.getChild(0)); // VariableExpressionNode
+ getVisitor().walk(node.getChild(0)); // VariableExpressionNode
write(" ");
- visitor.walk(node.getNameExpressionNode());
+ getVisitor().walk(node.getNameExpressionNode());
// add :Type
if (!javascriptMode)
{
@@ -289,7 +215,7 @@ public class JSEmitter implements IJSEmi
write(":");
}
- visitor.walk(node.getVariableTypeNode());
+ getVisitor().walk(node.getVariableTypeNode());
}
IExpressionNode vnode = node.getAssignedValueNode();
if (vnode != null)
@@ -297,15 +223,14 @@ public class JSEmitter implements IJSEmi
write(" = ");
if (vnode instanceof FunctionObjectNode)
{
- visitor.pushContext(TraverseContext.FUNCTION);
- visitor.walk(vnode.getChild(0)); // IFunctionNode
- visitor.popContext(TraverseContext.FUNCTION);
+ //getVisitor().pushContext(TraverseContext.FUNCTION);
+ getVisitor().walk(vnode.getChild(0)); // IFunctionNode
+ //getVisitor().popContext(TraverseContext.FUNCTION);
}
else
{
- visitor.walk(vnode);
+ getVisitor().walk(vnode);
}
}
}
-
}
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSWriter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSWriter.java?rev=1423195&r1=1423194&r2=1423195&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSWriter.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSWriter.java Mon Dec 17 22:24:16 2012
@@ -25,10 +25,10 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
+import org.apache.flex.compiler.js.IJSWriter;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.projects.IASProject;
import org.apache.flex.compiler.units.ICompilationUnit;
-import org.apache.flex.js.IJSWriter;
public class JSWriter implements IJSWriter
{
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=1423195&r1=1423194&r2=1423195&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 Mon Dec 17 22:24:16 2012
@@ -29,6 +29,7 @@ import org.apache.flex.compiler.exceptio
import org.apache.flex.compiler.internal.driver.JSApplication;
import org.apache.flex.compiler.internal.js.codgen.JSSharedData;
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;
@@ -36,7 +37,6 @@ import org.apache.flex.compiler.targets.
import org.apache.flex.compiler.targets.ITargetReport;
import org.apache.flex.compiler.targets.ITargetSettings;
import org.apache.flex.compiler.units.ICompilationUnit;
-import org.apache.flex.js.IJSApplication;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSApplication.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSApplication.java?rev=1423195&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSApplication.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSApplication.java Mon Dec 17 22:24:16 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.js;
+
+
+/**
+ * The JavaScript model interface used when implementing build targets that
+ * create javascript applications cross compiled from actionscript.
+ *
+ * @author Michael Schmalle
+ */
+public interface IJSApplication
+{
+
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSApplication.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSDocEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSDocEmitter.java?rev=1423195&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSDocEmitter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSDocEmitter.java Mon Dec 17 22:24:16 2012
@@ -0,0 +1,139 @@
+/*
+ *
+ * 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;
+
+import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.definitions.ITypeDefinition;
+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 IJSDocEmitter} 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 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/IJSDocEmitter.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSEmitter.java?rev=1423195&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSEmitter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSEmitter.java Mon Dec 17 22:24:16 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;
+
+import java.io.Writer;
+
+import org.apache.flex.as.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/IJSEmitter.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSWriter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSWriter.java?rev=1423195&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSWriter.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSWriter.java Mon Dec 17 22:24:16 2012
@@ -0,0 +1,51 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.js;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * A JavaScript writer that outputs cross compiled string data to the
+ * output stream.
+ *
+ * @author Michael Schmalle
+ */
+public interface IJSWriter extends Closeable
+{
+ /**
+ * Start writing to output stream.
+ *
+ * @param out output stream
+ */
+ void writeTo(OutputStream out);
+
+ /**
+ * Start writing to a file.
+ *
+ * @param out The output {@link File}.
+ * @return The number of bytes written.
+ */
+ int writeTo(File out) throws FileNotFoundException, IOException;
+
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/js/IJSWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/targets/IJSTarget.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/targets/IJSTarget.java?rev=1423195&r1=1423194&r2=1423195&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/targets/IJSTarget.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/targets/IJSTarget.java Mon Dec 17 22:24:16 2012
@@ -23,9 +23,9 @@ import java.util.Collection;
import org.apache.flex.compiler.clients.IBackend;
import org.apache.flex.compiler.clients.JSConfiguration;
+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.js.IJSApplication;
/**
* The {@link IJSTarget} interface allows the compiler an abstraction to
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java?rev=1423195&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java Mon Dec 17 22:24:16 2012
@@ -0,0 +1,43 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.visitor;
+
+import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.definitions.IInterfaceDefinition;
+import org.apache.flex.compiler.definitions.ITypeDefinition;
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.tree.as.IASNode;
+
+/**
+ * @author Michael Schmalle
+ */
+public interface IASBlockWalker extends IASBlockVisitor
+{
+ ICompilerProject getProject();
+
+ ITypeDefinition getCurrentType();
+
+ IClassDefinition getCurrentClass();
+
+ IInterfaceDefinition getCurrentInterface();
+
+ void walk(IASNode node);
+
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASBlockWalker.java
------------------------------------------------------------------------------
svn:eol-style = native