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/14 17:17:31 UTC
svn commit: r1421955 - in /incubator/flex/whiteboard/mschmalle/falconjx:
compiler.jx.tests/src/org/apache/flex/js/internal/driver/
compiler.jx/src/org/apache/flex/compiler/clients/
compiler.jx/src/org/apache/flex/compiler/internal/driver/ compiler.jx/s...
Author: mschmalle
Date: Fri Dec 14 16:17:27 2012
New Revision: 1421955
URL: http://svn.apache.org/viewvc?rev=1421955&view=rev
Log:
Flex:FalconJx
- Documented a lot of the interface API
- Reorganized some methods
- moved IASBlockVisitor to visitor package
- removes all warnings, unit tests pass
Modified:
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestExpressions.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestWalkerBase.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/JSConfiguration.java
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/JSBackend.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSCompilationUnit.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/ASNodeHandler.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/BeforeAfterStrategy.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/JSEmitter.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSSharedData.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/visitor/ASNodeSwitch.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/targets/IJSTarget.java
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSDocEmitter.java
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestExpressions.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestExpressions.java?rev=1421955&r1=1421954&r2=1421955&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestExpressions.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestExpressions.java Fri Dec 14 16:17:27 2012
@@ -39,7 +39,7 @@ import org.apache.flex.compiler.tree.as.
import org.apache.flex.compiler.tree.as.IReturnNode;
import org.apache.flex.compiler.tree.as.ITernaryOperatorNode;
import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
-import org.apache.flex.js.IASBlockVisitor;
+import org.apache.flex.compiler.visitor.IASBlockVisitor;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestWalkerBase.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestWalkerBase.java?rev=1421955&r1=1421954&r2=1421955&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestWalkerBase.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestWalkerBase.java Fri Dec 14 16:17:27 2012
@@ -9,7 +9,7 @@ import java.io.Writer;
import org.apache.flex.compiler.clients.IBackend;
import org.apache.flex.compiler.internal.driver.JSBackend;
import org.apache.flex.compiler.internal.js.codgen.JSFilterWriter;
-import org.apache.flex.js.IASBlockVisitor;
+import org.apache.flex.compiler.visitor.IASBlockVisitor;
import org.junit.After;
public class TestWalkerBase extends TestBase
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/JSConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/JSConfiguration.java?rev=1421955&r1=1421954&r2=1421955&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/JSConfiguration.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/JSConfiguration.java Fri Dec 14 16:17:27 2012
@@ -25,6 +25,17 @@ import org.apache.flex.compiler.exceptio
import org.apache.flex.compiler.internal.config.annotations.Config;
import org.apache.flex.compiler.internal.config.annotations.Mapping;
+/**
+ * The {@link JSConfiguration} class holds all compiler arguments needed
+ * for compiling ActionScript to JavaScript.
+ * <p>
+ * Specific flags are implemented here for the configuration to be loaded by
+ * the configure() method of {@link MXMLJSC}.
+ * <p>
+ * This class inherits all compiler arguments from the MXMLC compiler.
+ *
+ * @author Michael Schmalle
+ */
public class JSConfiguration extends Configuration
{
public JSConfiguration()
@@ -32,21 +43,21 @@ public class JSConfiguration extends Con
}
//
- // 'jasdoc.main-title' option
+ // 'mxmljsc.foo-bar' option
//
- private String mainTitle;
+ private String fooBar;
- public String getMainTitle()
+ public String getFooBar()
{
- return mainTitle;
+ return fooBar;
}
@Config(allowMultiple = false)
- @Mapping({ "jasdoc", "main-title" })
- public void setMainTitle(ConfigurationValue cv, String value)
+ @Mapping({ "mxmljsc", "foo-bar" })
+ public void setFooBar(ConfigurationValue cv, String value)
throws BadValue
{
- mainTitle = value;
+ fooBar = value;
}
}
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=1421955&r1=1421954&r2=1421955&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 Fri Dec 14 16:17:27 2012
@@ -483,7 +483,7 @@ public class MXMLJSC
//JSSharedData.DEBUG = config.debug();
//JSSharedData.OPTIMIZE = !config.debug() && config.optimize();
- final Set<ICompilationUnit> compilationUnits = new HashSet<ICompilationUnit>();
+ //--- final Set<ICompilationUnit> compilationUnits = new HashSet<ICompilationUnit>();
// XXX // add builtins?
@@ -493,21 +493,21 @@ public class MXMLJSC
public static void registerSWCs(CompilerProject project)
throws InterruptedException
{
- final JSSharedData sharedData = JSSharedData.instance;
-
- // collect all SWCCompilationUnit in swcUnits
- final List<ICompilationUnit> swcUnits = new ArrayList<ICompilationUnit>();
- for (ICompilationUnit cu : project.getCompilationUnits())
- {
- // if (cu instanceof SWCCompilationUnit)
- // swcUnits.add(cu);
- //
- // final List<IDefinition> defs = getDefinitions(cu, false);
- // for (IDefinition def : defs)
- // {
- // sharedData.registerDefinition(def);
- // }
- }
+// final JSSharedData sharedData = JSSharedData.instance;
+//
+// // collect all SWCCompilationUnit in swcUnits
+// final List<ICompilationUnit> swcUnits = new ArrayList<ICompilationUnit>();
+// for (ICompilationUnit cu : project.getCompilationUnits())
+// {
+// // if (cu instanceof SWCCompilationUnit)
+// // swcUnits.add(cu);
+// //
+// // final List<IDefinition> defs = getDefinitions(cu, false);
+// // for (IDefinition def : defs)
+// // {
+// // sharedData.registerDefinition(def);
+// // }
+// }
}
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSBackend.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSBackend.java?rev=1421955&r1=1421954&r2=1421955&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSBackend.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSBackend.java Fri Dec 14 16:17:27 2012
@@ -39,9 +39,13 @@ import org.apache.flex.compiler.problems
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;
/**
+ * 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
@@ -79,10 +83,9 @@ public class JSBackend implements IBacke
JSEmitter emitter = new JSEmitter(out);
ASBlockWalker walker = new ASBlockWalker(errors, project, emitter);
- BeforeAfterStrategy strategy = new BeforeAfterStrategy();
- strategy.setHandler(new ASNodeSwitch(walker));
- strategy.setBefore(new BeforeNodeStrategy(emitter));
- strategy.setAfter(new AfterNodeStrategy(emitter));
+ BeforeAfterStrategy strategy = new BeforeAfterStrategy(
+ new ASNodeSwitch(walker), new BeforeNodeStrategy(emitter),
+ new AfterNodeStrategy(emitter));
walker.setStrategy(strategy);
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSCompilationUnit.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSCompilationUnit.java?rev=1421955&r1=1421954&r2=1421955&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSCompilationUnit.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSCompilationUnit.java Fri Dec 14 16:17:27 2012
@@ -28,25 +28,19 @@ import org.apache.flex.compiler.internal
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.IABCBytesRequestResult;
import org.apache.flex.compiler.units.requests.IOutgoingDependenciesRequestResult;
/**
* JSCompilationUnit is the CompilationUnit for compiling ActionScript source
- * files to JavasScript. JSCompilationUnit is derived from ASCompilationUnit and
- * overrides the parts that generate the code. JSCompilationUnit also supports
- * requests for two-pass compilation (see m_needsSecondPass).
- * JSSourceFileHandler 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
+ * files to JavasScript.
+ * <p>
+ * JSCompilationUnit is derived from ASCompilationUnit and overrides the parts
+ * that generate the code.
*/
-
public class JSCompilationUnit extends ASCompilationUnit
{
- private IABCBytesRequestResult m_abcBytes = null;
- private Boolean m_needsSecondPass = false;
- private Boolean m_inCodeGen = false;
+ @SuppressWarnings("unused")
+ private Boolean inCodeGen = false;
/**
* Create a compilation unit from an ABC file.
@@ -215,9 +209,9 @@ public class JSCompilationUnit extends A
public void waitForBuildFinish(final Collection<ICompilerProblem> problems,
TargetType targetType) throws InterruptedException
{
- m_inCodeGen = true;
+ inCodeGen = true;
super.waitForBuildFinish(problems, targetType);
- m_inCodeGen = false;
+ inCodeGen = false;
}
}
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/ASNodeHandler.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/ASNodeHandler.java?rev=1421955&r1=1421954&r2=1421955&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/ASNodeHandler.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/ASNodeHandler.java Fri Dec 14 16:17:27 2012
@@ -23,29 +23,60 @@ import org.apache.flex.compiler.tree.as.
import org.apache.flex.compiler.visitor.IASNodeStrategy;
/**
+ * A concrete implementation of the {@link IASNodeStrategy} that allows a
+ * subclass to either implement the {@link IASNode} handling directly or pass a
+ * child {@link IASNodeStrategy} that this class will delegate it's
+ * {@link #handle(IASNode)} method to.
+ *
* @author Michael Schmalle
+ *
+ * @see BeforeAfterStrategy
*/
public class ASNodeHandler implements IASNodeStrategy
{
- IASNodeStrategy handler;
+ private IASNodeStrategy handler;
+ /**
+ * Returns the {@link IASNodeStrategy} currently being used to handle
+ * {@link IASNode} AST.
+ *
+ * @return The current strategy.
+ */
public IASNodeStrategy getHandler()
{
return handler;
}
- public void setHandler(IASNodeStrategy filtered)
+ /**
+ * Sets the {@link IASNode} handler strategy.
+ *
+ * @param handler The {@link IASNodeStrategy} to handle the specific
+ * {@link IASNode}.
+ */
+ public void setHandler(IASNodeStrategy handler)
{
- this.handler = filtered;
+ this.handler = handler;
}
+ /**
+ * Constructor, used when this handler directly implements
+ * {@link #handle(IASNode)} and does not composite a child
+ * {@link IASNodeStrategy}.
+ */
public ASNodeHandler()
{
}
- public ASNodeHandler(IASNodeStrategy filtered)
+ /**
+ * Constructor, creates a node strategy that composites a child
+ * {@link IASNodeStrategy} implemented in the {@link #handle(IASNode)}
+ * method.
+ *
+ * @param handler The {@link IASNode} handler to be used in this strategy.
+ */
+ public ASNodeHandler(IASNodeStrategy handler)
{
- this.handler = filtered;
+ this.handler = handler;
}
@Override
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=1421955&r1=1421954&r2=1421955&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 Fri Dec 14 16:17:27 2012
@@ -19,21 +19,27 @@
package org.apache.flex.compiler.internal.driver.strategy;
-import org.apache.flex.compiler.internal.js.codgen.JSEmitter;
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
+ * {@link IASNode} processing after the current node handler.
+ * <p>
+ * The class has access to the current {@link IJSEmitter} instance being used to
+ * output source code to the current output buffer.
+ *
* @author Michael Schmalle
*/
public class AfterNodeStrategy implements IASNodeStrategy
{
- private final JSEmitter emitter;
+ private final IJSEmitter emitter;
- public AfterNodeStrategy(JSEmitter emitter)
+ public AfterNodeStrategy(IJSEmitter emitter)
{
this.emitter = emitter;
}
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeAfterStrategy.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeAfterStrategy.java?rev=1421955&r1=1421954&r2=1421955&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeAfterStrategy.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeAfterStrategy.java Fri Dec 14 16:17:27 2012
@@ -20,65 +20,122 @@
package org.apache.flex.compiler.internal.driver.strategy;
import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IBlockNode;
import org.apache.flex.compiler.visitor.IASNodeStrategy;
/**
+ * The {@link BeforeAfterStrategy} implements a before and after {@link IASNode}
+ * handler.
+ * <p>
+ * When {@link #handle(IASNode)} is called on an instance of this class, the
+ * default {@link #handle(IASNode)} method will first call the
+ * {@link #getBefore()} handle() method , the will call the supers handle()
+ * implementation which is to call the {@link #getHandler()} handle() method.
+ * Finally, the {@link #getAfter()} handler's handle() method will be called.
+ * <p>
+ * Currently, this strategy is used for indenting and {@link IBlockNode} pre and
+ * post symbol management.
+ *
* @author Michael Schmalle
*/
public class BeforeAfterStrategy extends ASNodeHandler
{
private IASNodeStrategy before;
-
- private IASNodeStrategy after;
-
- public BeforeAfterStrategy()
- {
- }
-
- public BeforeAfterStrategy(IASNodeStrategy filtered,
- IASNodeStrategy before, IASNodeStrategy after)
- {
- super(filtered);
- this.before = before;
- this.after = after;
- }
- public void handle(IASNode element)
+ /**
+ * Returns the {@link IASNodeStrategy} called before the
+ * {@link #getHandler()}'s handle() method.
+ *
+ * @return The before handler.
+ */
+ public IASNodeStrategy getBefore()
{
- before(element);
- super.handle(element);
- after(element);
+ return before;
}
- protected void after(IASNode element)
+ /**
+ * Sets the before handler.
+ *
+ * @param before The before handler.
+ */
+ public void setBefore(IASNodeStrategy value)
{
- if (after != null)
- after.handle(element);
+ this.before = value;
}
- protected void before(IASNode element)
- {
- if (before != null)
- before.handle(element);
- }
+ private IASNodeStrategy after;
- public IASNodeStrategy getBefore()
+ /**
+ * Returns the {@link IASNodeStrategy} called after the
+ * {@link #getHandler()}'s handle() method.
+ *
+ * @return The after handler.
+ */
+ public IASNodeStrategy getAfter()
{
- return before;
+ return after;
}
- public void setBefore(IASNodeStrategy before)
+ /**
+ * Sets the after handler.
+ *
+ * @param after The after handler.
+ */
+ public void setAfter(IASNodeStrategy value)
+ {
+ this.after = value;
+ }
+
+ /**
+ * Constructor, creates a strategy that implements a before and after
+ * {@link IASNodeStrategy}.
+ *
+ * @param handler The handler that will be called between the before and
+ * after {@link #handle(IASNode)} method.
+ * @param before The before handler.
+ * @param after The after handler.
+ */
+ public BeforeAfterStrategy(IASNodeStrategy handler, IASNodeStrategy before,
+ IASNodeStrategy after)
{
+ super(handler);
this.before = before;
+ this.after = after;
}
- public IASNodeStrategy getAfter()
+ @Override
+ public void handle(IASNode node)
{
- return after;
+ before(node);
+ super.handle(node);
+ after(node);
+ }
+
+ /**
+ * Called before the {@link #handle(IASNode)} method.
+ * <p>
+ * If the {@link #getAfter()} strategy is <code>null</code>, this method
+ * does nothing.
+ *
+ * @param node The current {@link IASNode} being handled by the strategy.
+ */
+ protected void after(IASNode node)
+ {
+ if (after != null)
+ after.handle(node);
}
- public void setAfter(IASNodeStrategy after)
+ /**
+ * Called after the {@link #handle(IASNode)} method.
+ * <p>
+ * If the {@link #getBefore()} strategy is <code>null</code>, this method
+ * does nothing.
+ *
+ * @param node The current {@link IASNode} being handled by the strategy.
+ */
+ protected void before(IASNode node)
{
- this.after = after;
+ if (before != null)
+ before.handle(node);
}
}
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=1421955&r1=1421954&r2=1421955&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 Fri Dec 14 16:17:27 2012
@@ -19,19 +19,24 @@
package org.apache.flex.compiler.internal.driver.strategy;
-import org.apache.flex.compiler.internal.js.codgen.JSEmitter;
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
+ * {@link IASNode} processing before the current node handler.
+ *
+ * @author Michael Schmalle
+ */
public class BeforeNodeStrategy implements IASNodeStrategy
{
+ private final IJSEmitter emitter;
- private final JSEmitter emitter;
-
- public BeforeNodeStrategy(JSEmitter emitter)
+ public BeforeNodeStrategy(IJSEmitter emitter)
{
this.emitter = emitter;
}
@@ -50,7 +55,7 @@ public class BeforeNodeStrategy implemen
if (node.getChildCount() != 0)
emitter.indentPush();
}
-
+
// switch cases are SYNTHESIZED
if (type != ContainerType.IMPLICIT
&& type != ContainerType.SYNTHESIZED)
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=1421955&r1=1421954&r2=1421955&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 Fri Dec 14 16:17:27 2012
@@ -91,8 +91,8 @@ import org.apache.flex.compiler.tree.as.
import org.apache.flex.compiler.tree.metadata.IMetaTagNode;
import org.apache.flex.compiler.tree.metadata.IMetaTagsNode;
import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.visitor.IASBlockVisitor;
import org.apache.flex.compiler.visitor.IASNodeStrategy;
-import org.apache.flex.js.IASBlockVisitor;
/**
* A base implementation of the {@link IASBlockVisitor} that will walk the
@@ -104,7 +104,6 @@ public class ASBlockWalker implements IA
{
/**
* The context stack of the visitor.
- *
* <p>
* The context can only contain what is beneath them, CLASS contains
* FUNCTION.
@@ -128,6 +127,11 @@ public class ASBlockWalker implements IA
private final List<ICompilerProblem> errors;
+ List<ICompilerProblem> getErrors()
+ {
+ return errors;
+ }
+
//----------------------------------
// context
//----------------------------------
@@ -1271,4 +1275,5 @@ public class ASBlockWalker implements IA
return node.getContainerType() == ContainerType.IMPLICIT
|| node.getContainerType() == ContainerType.SYNTHESIZED;
}
+
}
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=1421955&r1=1421954&r2=1421955&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 Fri Dec 14 16:17:27 2012
@@ -37,11 +37,12 @@ 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
+public class JSEmitter implements IJSEmitter
{
private static final String NL = "\n";
@@ -92,7 +93,8 @@ public class JSEmitter
{
write(value);
}
-
+
+ @Override
public void write(String value)
{
try
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSSharedData.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSSharedData.java?rev=1421955&r1=1421954&r2=1421955&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSSharedData.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSSharedData.java Fri Dec 14 16:17:27 2012
@@ -43,6 +43,7 @@ public class JSSharedData
public static PrintStream STDOUT = System.out;
public static PrintStream STDERR = System.err;
+ @SuppressWarnings("unused")
private Boolean m_verbose = false;
private final ReadWriteLock m_verboseLock = new ReentrantReadWriteLock();
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/visitor/ASNodeSwitch.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/visitor/ASNodeSwitch.java?rev=1421955&r1=1421954&r2=1421955&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/visitor/ASNodeSwitch.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/visitor/ASNodeSwitch.java Fri Dec 14 16:17:27 2012
@@ -65,8 +65,8 @@ import org.apache.flex.compiler.tree.as.
import org.apache.flex.compiler.tree.metadata.IMetaTagNode;
import org.apache.flex.compiler.tree.metadata.IMetaTagsNode;
import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.visitor.IASBlockVisitor;
import org.apache.flex.compiler.visitor.IASNodeStrategy;
-import org.apache.flex.js.IASBlockVisitor;
/**
* @author Michael Schmalle
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=1421955&r1=1421954&r2=1421955&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 Fri Dec 14 16:17:27 2012
@@ -21,21 +21,32 @@ package org.apache.flex.compiler.targets
import java.util.Collection;
+import org.apache.flex.compiler.clients.IBackend;
+import org.apache.flex.compiler.clients.JSConfiguration;
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
+ * <em>how</em> the actual JavaScript is built.
+ * <p>
+ * The interface ties into the {@link IBackend} and is created at the start of
+ * compile before the {@link JSConfiguration} class is configured.
+ *
* @author Michael Schmalle
+ *
+ * @see IBackend#createJSTarget(IASProject, ITargetSettings,
+ * ITargetProgressMonitor)
*/
public interface IJSTarget extends ITarget
{
-
/**
* Build the target JavaScript application and collect problems. Every time
- * the method is called, a new IJSApplication model is created.
+ * the method is called, a new {@link IJSApplication} model is created.
*
* @param problems compilation problems output
- * @return IJSApplication if build is success
+ * @return IJSApplication if build is a success.
*/
IJSApplication build(Collection<ICompilerProblem> problems);
}
Modified: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSDocEmitter.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSDocEmitter.java?rev=1421955&r1=1421954&r2=1421955&view=diff
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSDocEmitter.java (original)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSDocEmitter.java Fri Dec 14 16:17:27 2012
@@ -27,6 +27,22 @@ import org.apache.flex.compiler.tree.as.
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
{
/*
@@ -84,41 +100,40 @@ public interface IJSDocEmitter
*
* @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);
}