You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/10/21 15:16:46 UTC
[08/44] git commit: [flex-falcon]
[refs/heads/feature-autobuild/maven-archetypes] - compiler.jx: JSCPublisher
differentitates between a main class that is ActionScript versus one that is
MXML, and does not call start() on an ActionScript main class
compiler.jx: JSCPublisher differentitates between a main class that is ActionScript versus one that is MXML, and does not call start() on an ActionScript main class
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/38611284
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/38611284
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/38611284
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: 386112843968b120cb91ee8118cee010886e6f28
Parents: 078fe69
Author: Josh Tynjala <jo...@gmail.com>
Authored: Wed Oct 5 14:37:55 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Wed Oct 5 14:37:55 2016 -0700
----------------------------------------------------------------------
.../internal/codegen/js/jsc/JSCPublisher.java | 27 ++++++++++++++++++++
1 file changed, 27 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/38611284/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jsc/JSCPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jsc/JSCPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jsc/JSCPublisher.java
index fd29f85..21c456c 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jsc/JSCPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jsc/JSCPublisher.java
@@ -24,14 +24,41 @@ import java.io.IOException;
import java.util.List;
import org.apache.flex.compiler.config.Configuration;
+import org.apache.flex.compiler.definitions.IDefinition;
import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSPublisher;
import org.apache.flex.compiler.internal.projects.FlexJSProject;
+import org.apache.flex.compiler.tree.as.IDefinitionNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
public class JSCPublisher extends MXMLFlexJSPublisher
{
public JSCPublisher(Configuration config, FlexJSProject project)
{
super(config, project);
+ this.project = project;
+ }
+
+ private FlexJSProject project;
+
+ @Override
+ protected String getTemplateBody(String projectName)
+ {
+ IDefinition def = project.resolveQNameToDefinition(projectName);
+ IDefinitionNode node = def.getNode();
+ if (node instanceof IMXMLDocumentNode)
+ {
+ //we should probably customize MXML too, but for now, pass it to the
+ //default implementation -JT
+ return super.getTemplateBody(projectName);
+ }
+ //for ActionScript classes, simply call the constructor by default
+ StringBuilder bodyHTML = new StringBuilder();
+ bodyHTML.append("\t<script type=\"text/javascript\">\n");
+ bodyHTML.append("\t\tnew ");
+ bodyHTML.append(projectName);
+ bodyHTML.append("();\n");
+ bodyHTML.append("\t</script>\n");
+ return bodyHTML.toString();
}
@Override