You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/06/27 07:32:24 UTC
git commit: [flex-falcon] [refs/heads/develop] - add JSC backend to
not output CSS and not use _ in class names
Repository: flex-falcon
Updated Branches:
refs/heads/develop 500ad4e4a -> 3a20c7fcd
add JSC backend to not output CSS and not use _ in class names
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/3a20c7fc
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/3a20c7fc
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/3a20c7fc
Branch: refs/heads/develop
Commit: 3a20c7fcd0b06f2696cc653e96e139fd2d19b40a
Parents: 500ad4e
Author: Alex Harui <ah...@apache.org>
Authored: Fri Jun 26 22:29:50 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Jun 26 22:29:50 2015 -0700
----------------------------------------------------------------------
.../apache/flex/compiler/clients/COMPJSC.java | 6 +
.../apache/flex/compiler/clients/MXMLJSC.java | 6 +-
.../internal/codegen/js/jsc/JSCJSEmitter.java | 91 ++++++++++++++
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 2 +-
.../mxml/flexjs/MXMLFlexJSPublisher.java | 8 +-
.../codegen/mxml/jsc/MXMLJSCJSEmitter.java | 46 +++++++
.../driver/mxml/jsc/MXMLJSCJSBackend.java | 121 +++++++++++++++++++
.../driver/mxml/jsc/MXMLJSCJSSWCBackend.java | 121 +++++++++++++++++++
8 files changed, 396 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3a20c7fc/compiler.jx/src/org/apache/flex/compiler/clients/COMPJSC.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/clients/COMPJSC.java b/compiler.jx/src/org/apache/flex/compiler/clients/COMPJSC.java
index c288f33..c8f2141 100644
--- a/compiler.jx/src/org/apache/flex/compiler/clients/COMPJSC.java
+++ b/compiler.jx/src/org/apache/flex/compiler/clients/COMPJSC.java
@@ -31,6 +31,8 @@ import org.apache.flex.compiler.internal.driver.as.ASBackend;
import org.apache.flex.compiler.internal.driver.js.amd.AMDBackend;
import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSSWCBackend;
+import org.apache.flex.compiler.internal.driver.mxml.jsc.MXMLJSCJSBackend;
+import org.apache.flex.compiler.internal.driver.mxml.jsc.MXMLJSCJSSWCBackend;
import org.apache.flex.compiler.internal.driver.mxml.vf2js.MXMLVF2JSSWCBackend;
import org.apache.flex.compiler.internal.projects.CompilerProject;
import org.apache.flex.compiler.internal.targets.JSTarget;
@@ -113,6 +115,10 @@ public class COMPJSC extends MXMLJSC
case AMD:
backend = new AMDBackend();
break;
+
+ case JSC:
+ backend = new MXMLJSCJSSWCBackend();
+ break;
case FLEXJS:
case FLEXJS_DUAL:
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3a20c7fc/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java b/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
index ae9e76a..f39c4be 100644
--- a/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
+++ b/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
@@ -50,6 +50,7 @@ import org.apache.flex.compiler.internal.driver.js.amd.AMDBackend;
import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSBackend;
+import org.apache.flex.compiler.internal.driver.mxml.jsc.MXMLJSCJSBackend;
import org.apache.flex.compiler.internal.driver.mxml.vf2js.MXMLVF2JSBackend;
import org.apache.flex.compiler.internal.parsing.as.FlexJSASDocDelegate;
import org.apache.flex.compiler.internal.projects.CompilerProject;
@@ -87,7 +88,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider, Flex
*/
public enum JSOutputType
{
- AMD("amd"), FLEXJS("flexjs"), GOOG("goog"), VF2JS("vf2js"), FLEXJS_DUAL("flexjs_dual");
+ AMD("amd"), FLEXJS("flexjs"), GOOG("goog"), VF2JS("vf2js"), FLEXJS_DUAL("flexjs_dual"), JSC("jsc");
private String text;
@@ -190,6 +191,9 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider, Flex
case AMD:
backend = new AMDBackend();
break;
+ case JSC:
+ backend = new MXMLJSCJSBackend();
+ break;
case FLEXJS:
case FLEXJS_DUAL:
backend = new MXMLFlexJSBackend();
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3a20c7fc/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jsc/JSCJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jsc/JSCJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jsc/JSCJSEmitter.java
new file mode 100644
index 0000000..c888f93
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jsc/JSCJSEmitter.java
@@ -0,0 +1,91 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jsc;
+
+import java.io.FilterWriter;
+
+import org.apache.flex.compiler.codegen.js.flexjs.IJSFlexJSEmitter;
+import org.apache.flex.compiler.codegen.js.goog.IJSGoogDocEmitter;
+import org.apache.flex.compiler.definitions.IPackageDefinition;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSDocEmitter;
+import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
+import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitter;
+import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.jx.AccessorEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.AsIsEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.BinaryOperatorEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.BindableEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.ClassEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.DefinePropertyFunctionEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.FieldEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.ForEachEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.FunctionCallEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.IdentifierEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.InterfaceEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.LiteralEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.MemberAccessEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.MethodEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.ObjectDefinePropertyEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.PackageFooterEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.PackageHeaderEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.SelfReferenceEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.SuperCallEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.VarDeclarationEmitter;
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IAccessorNode;
+import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+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.IForLoopNode;
+import org.apache.flex.compiler.tree.as.IFunctionCallNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IGetterNode;
+import org.apache.flex.compiler.tree.as.IIdentifierNode;
+import org.apache.flex.compiler.tree.as.IInterfaceNode;
+import org.apache.flex.compiler.tree.as.ILiteralNode;
+import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
+import org.apache.flex.compiler.tree.as.ISetterNode;
+import org.apache.flex.compiler.tree.as.ITypedExpressionNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+
+/**
+ * Concrete implementation of the 'FlexJS' JavaScript production.
+ *
+ * @author Michael Schmalle
+ * @author Erik de Bruin
+ */
+public class JSCJSEmitter extends JSFlexJSEmitter
+{
+
+ public JSCJSEmitter(FilterWriter out) {
+ super(out);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public String formatQualifiedName(String name)
+ {
+ return name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3a20c7fc/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 0f4e81f..6647000 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -1941,7 +1941,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
}
}
- private String formatQualifiedName(String name)
+ protected String formatQualifiedName(String name)
{
if (name.contains("goog.") || name.startsWith("Vector."))
return name;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3a20c7fc/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 92a92e6..582c130 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -392,9 +392,11 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
writeHTML("intermediate", projectName, intermediateDirPath, depsFileData.toString(), gdw.additionalHTML);
writeHTML("release", projectName, releaseDirPath, null, gdw.additionalHTML);
- writeCSS(projectName, intermediateDirPath);
- writeCSS(projectName, releaseDirPath);
-
+ if (project.needCSS) {
+ writeCSS(projectName, intermediateDirPath);
+ writeCSS(projectName, releaseDirPath);
+ }
+
/*
if (!subsetGoog)
{
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3a20c7fc/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/jsc/MXMLJSCJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/jsc/MXMLJSCJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/jsc/MXMLJSCJSEmitter.java
new file mode 100644
index 0000000..184158b
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/jsc/MXMLJSCJSEmitter.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.mxml.jsc;
+
+
+import java.io.FilterWriter;
+
+import org.apache.flex.compiler.codegen.mxml.flexjs.IMXMLFlexJSEmitter;
+import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitter;
+
+/**
+ * @author Erik de Bruin
+ */
+public class MXMLJSCJSEmitter extends MXMLFlexJSEmitter implements
+ IMXMLFlexJSEmitter
+{
+
+ public MXMLJSCJSEmitter(FilterWriter out) {
+ super(out);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ protected String formatQualifiedName(String name)
+ {
+ return name;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3a20c7fc/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/jsc/MXMLJSCJSBackend.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/jsc/MXMLJSCJSBackend.java b/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/jsc/MXMLJSCJSBackend.java
new file mode 100644
index 0000000..1e61a83
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/jsc/MXMLJSCJSBackend.java
@@ -0,0 +1,121 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.driver.mxml.jsc;
+
+import java.io.FilterWriter;
+import java.util.List;
+
+import org.apache.flex.compiler.codegen.IDocEmitter;
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.codegen.js.IJSWriter;
+import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogDocEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jsc.JSCJSEmitter;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLWriter;
+import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSBlockWalker;
+import org.apache.flex.compiler.internal.codegen.mxml.jsc.MXMLJSCJSEmitter;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.driver.mxml.MXMLBackend;
+import org.apache.flex.compiler.internal.targets.FlexJSTarget;
+import org.apache.flex.compiler.internal.targets.JSTarget;
+import org.apache.flex.compiler.internal.visitor.as.ASNodeSwitch;
+import org.apache.flex.compiler.internal.visitor.mxml.MXMLNodeSwitch;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.projects.IASProject;
+import org.apache.flex.compiler.targets.ITargetProgressMonitor;
+import org.apache.flex.compiler.targets.ITargetSettings;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.visitor.IBlockVisitor;
+import org.apache.flex.compiler.visitor.IBlockWalker;
+import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
+
+/**
+ * A concrete implementation of the {@link IBackend} API where the
+ * {@link MXMLBlockWalker} is used to traverse the {@link IMXMLFileNode} AST.
+ *
+ * @author Erik de Bruin
+ */
+public class MXMLJSCJSBackend extends MXMLBackend
+{
+
+ @Override
+ public Configurator createConfigurator()
+ {
+ return new Configurator(JSGoogConfiguration.class);
+ }
+
+ @Override
+ public IMXMLEmitter createMXMLEmitter(FilterWriter out)
+ {
+ return new MXMLJSCJSEmitter(out);
+ }
+
+ @Override
+ public IMXMLBlockWalker createMXMLWalker(IASProject project,
+ List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+ IASEmitter asEmitter, IBlockWalker asBlockWalker)
+ {
+ MXMLBlockWalker walker = new MXMLFlexJSBlockWalker(errors, project,
+ mxmlEmitter, asEmitter, asBlockWalker);
+
+ ASNodeSwitch asStrategy = new ASNodeSwitch(
+ (IBlockVisitor) asBlockWalker);
+ walker.setASStrategy(asStrategy);
+
+ MXMLNodeSwitch mxmlStrategy = new MXMLNodeSwitch(walker);
+ walker.setMXMLStrategy(mxmlStrategy);
+
+ return walker;
+ }
+
+ @Override
+ public IDocEmitter createDocEmitter(IASEmitter emitter)
+ {
+ return new JSGoogDocEmitter((IJSEmitter) emitter);
+ }
+
+ @Override
+ public IJSEmitter createEmitter(FilterWriter out)
+ {
+ IJSEmitter emitter = new JSCJSEmitter(out);
+ emitter.setDocEmitter(createDocEmitter(emitter));
+ return emitter;
+ }
+
+ @Override
+ public IJSWriter createMXMLWriter(IASProject project,
+ List<ICompilerProblem> problems, ICompilationUnit compilationUnit,
+ boolean enableDebug)
+ {
+ return new MXMLWriter(project, problems, compilationUnit, enableDebug);
+ }
+
+ @Override
+ public JSTarget createTarget(IASProject project, ITargetSettings settings,
+ ITargetProgressMonitor monitor)
+ {
+ return new FlexJSTarget(project, settings, monitor);
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3a20c7fc/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/jsc/MXMLJSCJSSWCBackend.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/jsc/MXMLJSCJSSWCBackend.java b/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/jsc/MXMLJSCJSSWCBackend.java
new file mode 100644
index 0000000..3657c7e
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/driver/mxml/jsc/MXMLJSCJSSWCBackend.java
@@ -0,0 +1,121 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.driver.mxml.jsc;
+
+import java.io.FilterWriter;
+import java.util.List;
+
+import org.apache.flex.compiler.codegen.IDocEmitter;
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.codegen.js.IJSWriter;
+import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogDocEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jsc.JSCJSEmitter;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker;
+import org.apache.flex.compiler.internal.codegen.mxml.MXMLWriter;
+import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSBlockWalker;
+import org.apache.flex.compiler.internal.codegen.mxml.jsc.MXMLJSCJSEmitter;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.driver.mxml.MXMLBackend;
+import org.apache.flex.compiler.internal.targets.FlexJSSWCTarget;
+import org.apache.flex.compiler.internal.targets.JSTarget;
+import org.apache.flex.compiler.internal.visitor.as.ASNodeSwitch;
+import org.apache.flex.compiler.internal.visitor.mxml.MXMLNodeSwitch;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.projects.IASProject;
+import org.apache.flex.compiler.targets.ITargetProgressMonitor;
+import org.apache.flex.compiler.targets.ITargetSettings;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.compiler.visitor.IBlockVisitor;
+import org.apache.flex.compiler.visitor.IBlockWalker;
+import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
+
+/**
+ * A concrete implementation of the {@link IBackend} API where the
+ * {@link MXMLBlockWalker} is used to traverse the {@link IMXMLFileNode} AST.
+ *
+ * @author Erik de Bruin
+ */
+public class MXMLJSCJSSWCBackend extends MXMLBackend
+{
+
+ @Override
+ public Configurator createConfigurator()
+ {
+ return new Configurator(JSGoogConfiguration.class);
+ }
+
+ @Override
+ public IMXMLEmitter createMXMLEmitter(FilterWriter out)
+ {
+ return new MXMLJSCJSEmitter(out);
+ }
+
+ @Override
+ public IMXMLBlockWalker createMXMLWalker(IASProject project,
+ List<ICompilerProblem> errors, IMXMLEmitter mxmlEmitter,
+ IASEmitter asEmitter, IBlockWalker asBlockWalker)
+ {
+ MXMLBlockWalker walker = new MXMLFlexJSBlockWalker(errors, project,
+ mxmlEmitter, asEmitter, asBlockWalker);
+
+ ASNodeSwitch asStrategy = new ASNodeSwitch(
+ (IBlockVisitor) asBlockWalker);
+ walker.setASStrategy(asStrategy);
+
+ MXMLNodeSwitch mxmlStrategy = new MXMLNodeSwitch(walker);
+ walker.setMXMLStrategy(mxmlStrategy);
+
+ return walker;
+ }
+
+ @Override
+ public IDocEmitter createDocEmitter(IASEmitter emitter)
+ {
+ return new JSGoogDocEmitter((IJSEmitter) emitter);
+ }
+
+ @Override
+ public IJSEmitter createEmitter(FilterWriter out)
+ {
+ IJSEmitter emitter = new JSCJSEmitter(out);
+ emitter.setDocEmitter(createDocEmitter(emitter));
+ return emitter;
+ }
+
+ @Override
+ public IJSWriter createMXMLWriter(IASProject project,
+ List<ICompilerProblem> problems, ICompilationUnit compilationUnit,
+ boolean enableDebug)
+ {
+ return new MXMLWriter(project, problems, compilationUnit, enableDebug);
+ }
+
+ @Override
+ public JSTarget createTarget(IASProject project, ITargetSettings settings,
+ ITargetProgressMonitor monitor)
+ {
+ return new FlexJSSWCTarget(project, settings, monitor);
+ }
+}