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 00:32:16 UTC
svn commit: r1421615 [1/4] - in
/incubator/flex/whiteboard/mschmalle/falconjx: ./ compiler.jx.tests/
compiler.jx.tests/src/ compiler.jx.tests/src/org/
compiler.jx.tests/src/org/apache/ compiler.jx.tests/src/org/apache/flex/
compiler.jx.tests/src/org/ap...
Author: mschmalle
Date: Thu Dec 13 23:32:01 2012
New Revision: 1421615
URL: http://svn.apache.org/viewvc?rev=1421615&view=rev
Log:
Flex: FalconJx Initial commit of prototype cross compiler
Added:
incubator/flex/whiteboard/mschmalle/falconjx/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.classpath (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.project (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/EnvProperties.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestBase.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestExpressions.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestStatements.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestWalkerBase.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.classpath (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.project (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/README (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/JSConfiguration.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSApplication.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSBackend.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSCompilationUnit.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/JSSourceFileHandler.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/ASNodeHandler.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/AfterNodeStrategy.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeAfterStrategy.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/driver/strategy/BeforeNodeStrategy.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/ASBlockWalker.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSDocEmitter.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSEmitter.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSFilterWriter.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSSharedData.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/js/codgen/JSWriter.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/targets/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/targets/JSTarget.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/visitor/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/visitor/ASNodeSwitch.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/internal/visitor/JSWalker.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/targets/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/targets/IJSTarget.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASNodeStrategy.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASTVisitor.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/visitor/IASWalker.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IASBlockVisitor.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSApplication.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSDocEmitter.java (with props)
incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/js/IJSWriter.java (with props)
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.classpath
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.classpath?rev=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.classpath (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.classpath Thu Dec 13 23:32:01 2012
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/compiler"/>
+ <classpathentry kind="lib" path="lib/junit-4.10.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/compiler.jx"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.classpath
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.project
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.project?rev=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.project (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.project Thu Dec 13 23:32:01 2012
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>compiler.jx.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/.project
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/EnvProperties.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/EnvProperties.java?rev=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/EnvProperties.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/EnvProperties.java Thu Dec 13 23:32:01 2012
@@ -0,0 +1,81 @@
+package org.apache.flex.js.internal.driver;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.flex.utils.FilenameNormalization;
+
+
+/**
+ * EnvProperties checks in following order for a value.
+ *
+ * 1) unittest.properties
+ * 2) environment variables
+ * 3) for key FLEX_HOME & PLAYERGLOBAL_HOME sets a default value.
+ */
+public class EnvProperties {
+
+ /**
+ * FLEX_HOME
+ */
+ public String SDK;
+
+ /**
+ * PLAYERGLOBAL_HOME
+ */
+ public String FPSDK;
+
+ /**
+ * AIR_HOME
+ */
+ public String AIRSDK;
+
+ /**
+ * FLASHPLAYER_DEBUGGER
+ */
+ public String FDBG;
+
+
+ private static EnvProperties propertyReader;
+
+ public static EnvProperties initiate() {
+ if(propertyReader == null) {
+ propertyReader = new EnvProperties();
+ propertyReader.setup();
+ }
+ return propertyReader;
+ }
+
+ private void setup()
+ {
+ Properties p = new Properties();
+ try {
+ File f = new File("unittest.properties");
+ p.load(new FileInputStream( f ));
+ } catch (FileNotFoundException e) {
+ System.out.println("unittest.properties not found");
+ } catch (IOException e) {
+ }
+
+ SDK = p.getProperty("FLEX_HOME", System.getenv("FLEX_HOME"));
+ if(SDK == null)
+ SDK = FilenameNormalization.normalize("../compiler/generated/dist/sdk");
+ System.out.println("Env - FLEX_HOME = " + SDK);
+
+ FPSDK = p.getProperty("PLAYERGLOBAL_HOME", System.getenv("PLAYERGLOBAL_HOME"));
+ if(FPSDK == null)
+ FPSDK = FilenameNormalization.normalize("../compiler/generated/dist/sdk/frameworks/libs/player");
+ System.out.println("Env - PLAYERGLOBAL_HOME = " + FPSDK);
+
+
+ AIRSDK = p.getProperty("AIR_HOME", System.getenv("AIR_HOME"));
+ System.out.println("Env - AIR_HOME = " + AIRSDK);
+
+ FDBG = p.getProperty("FLASHPLAYER_DEBUGGER", System.getenv("FLASHPLAYER_DEBUGGER"));
+ System.out.println("Env - FLASHPLAYER_DEBUGGER = " + FDBG);
+ }
+
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/EnvProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestBase.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestBase.java?rev=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestBase.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestBase.java Thu Dec 13 23:32:01 2012
@@ -0,0 +1,223 @@
+package org.apache.flex.js.internal.driver;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.flex.compiler.clients.MXMLJSC;
+import org.apache.flex.compiler.internal.projects.FlexProject;
+import org.apache.flex.compiler.internal.projects.FlexProjectConfigurator;
+import org.apache.flex.compiler.internal.tree.as.FunctionNode;
+import org.apache.flex.compiler.internal.units.SourceCompilationUnitFactory;
+import org.apache.flex.compiler.internal.workspaces.Workspace;
+import org.apache.flex.compiler.mxml.IMXMLNamespaceMapping;
+import org.apache.flex.compiler.mxml.MXMLNamespaceMapping;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
+import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.utils.FilenameNormalization;
+import org.junit.Before;
+
+public class TestBase
+{
+ protected void compileJS(String path)
+ {
+ // Construct a command line which simply loads the project's config file.
+ String playerglobalHome = System.getenv("PLAYERGLOBAL_HOME");
+ assertNotNull("Environment variable PLAYERGLOBAL_HOME is not set",
+ playerglobalHome);
+
+ String flexHome = System.getenv("FLEX_HOME");
+ assertNotNull("Environment variable FLEX_HOME is not set", flexHome);
+
+ String configFile = flexHome + "/frameworks/flex-config.xml";
+ String[] args = new String[] { "-load-config=" + configFile,
+ "+env.PLAYERGLOBAL_HOME=" + playerglobalHome,
+ "+playerglobal.version=11.1",
+ "-define=CONFIG::performanceInstrumentation,false", "" + path };
+
+ MXMLJSC.main(args);
+ }
+
+ protected List<ICompilerProblem> errors;
+
+ private static EnvProperties env = EnvProperties.initiate();
+
+ protected static Workspace workspace = new Workspace();
+
+ protected FlexProject project;
+
+ @Before
+ public void setUp()
+ {
+ assertNotNull("Environment variable FLEX_HOME is not set", env.SDK);
+ assertNotNull("Environment variable PLAYERGLOBAL_HOME is not set",
+ env.FPSDK);
+
+ errors = new ArrayList<ICompilerProblem>();
+
+ project = new FlexProject(workspace);
+ FlexProjectConfigurator.configure(project);
+ }
+
+ protected IASNode findFirstDescendantOfType(IASNode node,
+ Class<? extends IASNode> nodeType)
+ {
+ int n = node.getChildCount();
+ for (int i = 0; i < n; i++)
+ {
+ IASNode child = node.getChild(i);
+ if (child instanceof FunctionNode)
+ {
+ ((FunctionNode) child).parseFunctionBody(errors);
+ }
+ if (nodeType.isInstance(child))
+ return child;
+
+ IASNode found = findFirstDescendantOfType(child, nodeType);
+ if (found != null)
+ return found;
+ }
+
+ return null;
+ }
+
+ protected IFileNode getFileNode(String code)
+ {
+ String tempDir = FilenameNormalization.normalize("temp"); // ensure this exists
+
+ File tempASFile = null;
+ try
+ {
+ tempASFile = File.createTempFile(getClass().getSimpleName(), ".as",
+ new File(tempDir));
+ tempASFile.deleteOnExit();
+
+ BufferedWriter out = new BufferedWriter(new FileWriter(tempASFile));
+ out.write(code);
+ out.close();
+ }
+ catch (IOException e1)
+ {
+ e1.printStackTrace();
+ }
+
+ List<File> sourcePath = new ArrayList<File>();
+ sourcePath.add(new File(tempDir));
+ project.setSourcePath(sourcePath);
+
+ // Compile the code against playerglobal.swc.
+ List<File> libraries = new ArrayList<File>();
+ libraries.add(new File(FilenameNormalization.normalize(env.FPSDK
+ + "\\11.1\\playerglobal.swc")));
+ libraries.add(new File(FilenameNormalization.normalize(env.SDK
+ + "\\frameworks\\libs\\framework.swc")));
+ libraries.add(new File(FilenameNormalization.normalize(env.SDK
+ + "\\frameworks\\libs\\rpc.swc")));
+ libraries.add(new File(FilenameNormalization.normalize(env.SDK
+ + "\\frameworks\\libs\\spark.swc")));
+ project.setLibraries(libraries);
+
+ // Use the MXML 2009 manifest.
+ List<IMXMLNamespaceMapping> namespaceMappings = new ArrayList<IMXMLNamespaceMapping>();
+ IMXMLNamespaceMapping mxml2009 = new MXMLNamespaceMapping(
+ "http://ns.adobe.com/mxml/2009", env.SDK
+ + "\\frameworks\\mxml-2009-manifest.xml");
+ namespaceMappings.add(mxml2009);
+ project.setNamespaceMappings(namespaceMappings);
+
+ ICompilationUnit cu = null;
+ String normalizedMainFileName = FilenameNormalization
+ .normalize(tempASFile.getAbsolutePath());
+
+ SourceCompilationUnitFactory compilationUnitFactory = project
+ .getSourceCompilationUnitFactory();
+ File normalizedMainFile = new File(normalizedMainFileName);
+ if (compilationUnitFactory.canCreateCompilationUnit(normalizedMainFile))
+ {
+ Collection<ICompilationUnit> mainFileCompilationUnits = workspace
+ .getCompilationUnits(normalizedMainFileName, project);
+ for (ICompilationUnit cu2 : mainFileCompilationUnits)
+ {
+ if (cu2 != null)
+ cu = cu2;
+ }
+ }
+
+ // Build the AST.
+ IFileNode fileNode = null;
+ try
+ {
+ fileNode = (IFileNode) cu.getSyntaxTreeRequest().get().getAST();
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+
+ return fileNode;
+ }
+
+ protected IASNode getNode(String code, Class<? extends IASNode> type)
+ {
+ String source = "package {public class A {function a():void {" + code
+ + "}})";
+ IFileNode node = getFileNode(source);
+ if (type.isInstance(node))
+ return node;
+ IASNode child = (IASNode) findFirstDescendantOfType(node, type);
+ return child;
+ }
+
+ protected IExpressionNode getExpressionNode(String code,
+ Class<? extends IASNode> type)
+ {
+ String source = "package {public class A {function a():void {" + code
+ + "}})";
+ IFileNode node = getFileNode(source);
+ IExpressionNode child = (IExpressionNode) findFirstDescendantOfType(
+ node, type);
+ return child;
+ }
+
+ protected IUnaryOperatorNode getUnaryNode(String code)
+ {
+ String source = "package {public class A {function a():void {" + code
+ + "}})";
+ IFileNode node = getFileNode(source);
+ IUnaryOperatorNode child = (IUnaryOperatorNode) findFirstDescendantOfType(
+ node, IUnaryOperatorNode.class);
+ return child;
+ }
+
+ protected IBinaryOperatorNode getBinaryNode(String code)
+ {
+ String source = "package {public class A {function a():void {" + code
+ + "}})";
+ IFileNode node = getFileNode(source);
+ IBinaryOperatorNode child = (IBinaryOperatorNode) findFirstDescendantOfType(
+ node, IBinaryOperatorNode.class);
+ return child;
+ }
+
+ protected IDynamicAccessNode getDynamicAccessNode(String code)
+ {
+ String source = "package {public class A {function a():void {" + code
+ + "}})";
+ IFileNode node = getFileNode(source);
+ IDynamicAccessNode child = (IDynamicAccessNode) findFirstDescendantOfType(
+ node, IDynamicAccessNode.class);
+ return child;
+ }
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: 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=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestExpressions.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestExpressions.java Thu Dec 13 23:32:01 2012
@@ -0,0 +1,724 @@
+/*
+ *
+ * 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 static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.StringWriter;
+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.compiler.internal.tree.as.ArrayLiteralNode;
+import org.apache.flex.compiler.internal.tree.as.NamespaceAccessExpressionNode;
+import org.apache.flex.compiler.internal.tree.as.ObjectLiteralNode;
+import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
+import org.apache.flex.compiler.tree.as.IFunctionCallNode;
+import org.apache.flex.compiler.tree.as.IIterationFlowNode;
+import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
+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.junit.After;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author Michael Schmalle
+ */
+public class TestExpressions extends TestBase
+{
+ private IASBlockVisitor visitor;
+
+ private Writer out;
+
+ private IBackend backend;
+
+ private JSFilterWriter writer;
+
+ @Override
+ public void setUp()
+ {
+ super.setUp();
+
+ backend = new JSBackend();
+ out = new StringWriter();
+ writer = new JSFilterWriter(out);
+ visitor = backend.createWalker(project, errors, writer);
+ }
+
+ @After
+ public void tearDown()
+ {
+ backend = null;
+ out = null;
+ writer = null;
+ visitor = null;
+ }
+
+ // ILanguageIdentifierNode -> IIdentifierNode
+
+ @Test
+ public void testVisitLanguageIdentifierNode_This()
+ {
+ IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getNode(
+ "if (a) this.a;", IMemberAccessExpressionNode.class);
+ visitor.visitMemberAccessExpression(node);
+ assertOut("this.a");
+ }
+
+ @Test
+ public void testVisitLanguageIdentifierNode_SuperMember()
+ {
+ IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getNode(
+ "if (a) super.foo;", IMemberAccessExpressionNode.class);
+ visitor.visitMemberAccessExpression(node);
+ assertOut("super.foo");
+ }
+
+ @Test
+ public void testVisitLanguageIdentifierNode_SuperMethod_1()
+ {
+ // NOTE: This is here as an example that a method call to super
+ // is always held within a IFunctionCallNode, here it's a plain member access
+ IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getNode(
+ "if (a) super.foo();", IMemberAccessExpressionNode.class);
+ visitor.visitMemberAccessExpression(node);
+ assertOut("super.foo");
+ }
+
+ @Test
+ public void testVisitLanguageIdentifierNode_SuperMethod_2()
+ {
+ IFunctionCallNode node = (IFunctionCallNode) getNode(
+ "if (a) super.foo(a, b, c);", IFunctionCallNode.class);
+ visitor.visitFunctionCall(node);
+ assertOut("super.foo(a, b, c)");
+ }
+
+ @Test
+ public void testVisitLanguageIdentifierNode_This1()
+ {
+ IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getNode(
+ "if (a) this.a;", IMemberAccessExpressionNode.class);
+
+ visitor.visitMemberAccessExpression(node);
+ assertOut("this.a");
+ }
+
+ @Test
+ public void testVisitLanguageIdentifierNode_This2()
+ {
+ IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getNode(
+ "if (a) this.a;", IMemberAccessExpressionNode.class);
+
+ visitor.visitMemberAccessExpression(node);
+ assertOut("this.a");
+ }
+
+ //----------------------------------
+ // Primary expression keywords
+ //----------------------------------
+
+ //----------------------------------
+ // Arithmetic
+ //----------------------------------
+
+ @Test
+ public void testVisitBinaryOperatorNode_Plus()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a + b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a + b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_Minus()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a - b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a - b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_Divide()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a / b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a / b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_Modulo()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a % b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a % b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_Multiply()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a * b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a * b");
+ }
+
+ @Test
+ public void testVisitUnaryOperatorNode_PostIncrement()
+ {
+ IUnaryOperatorNode node = getUnaryNode("a++");
+ visitor.visitUnaryOperator(node);
+ assertOut("a++");
+ }
+
+ @Test
+ public void testVisitUnaryOperatorNode_PreIncrement()
+ {
+ IUnaryOperatorNode node = getUnaryNode("++a");
+ visitor.visitUnaryOperator(node);
+ assertOut("++a");
+ }
+
+ @Test
+ public void testVisitUnaryOperatorNode_PostDecrement()
+ {
+ IUnaryOperatorNode node = getUnaryNode("a--");
+ visitor.visitUnaryOperator(node);
+ assertOut("a--");
+ }
+
+ @Test
+ public void testVisitUnaryOperatorNode_PreDecrement()
+ {
+ IUnaryOperatorNode node = getUnaryNode("--a");
+ visitor.visitUnaryOperator(node);
+ assertOut("--a");
+ }
+
+ //----------------------------------
+ // Arithmetic compound assignment
+ //----------------------------------
+
+ @Test
+ public void testVisitBinaryOperatorNode_PlusAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a += b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a += b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_MinusAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a -= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a -= b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_DivideAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a /= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a /= b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_ModuloAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a %= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a %= b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_MultiplyAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a *= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a *= b");
+ }
+
+ //----------------------------------
+ // Assignment
+ //----------------------------------
+
+ @Test
+ public void testVisitBinaryOperatorNode_Assignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a = b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a = b");
+ }
+
+ //----------------------------------
+ // Bitwise
+ //----------------------------------
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseAnd()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a & b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a & b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseLeftShift()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a << b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a << b");
+ }
+
+ @Test
+ public void testVisitUnaryOperatorNode_BitwiseNot()
+ {
+ IUnaryOperatorNode node = getUnaryNode("~a");
+ visitor.visitUnaryOperator(node);
+ assertOut("~a");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseOr()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a | b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a | b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseRightShift()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a >> b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a >> b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseUnsignedRightShift()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a >>> b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a >>> b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseXOR()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a ^ b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a ^ b");
+ }
+
+ //----------------------------------
+ // Bitwise compound assignment
+ //----------------------------------
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseAndAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a &= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a &= b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseLeftShiftAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a <<= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a <<= b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseOrAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a |= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a |= b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseRightShiftAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a >>= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a >>= b");
+ }
+
+ @Test
+ public void
+ testVisitBinaryOperatorNode_BitwiseUnsignedRightShiftAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a >>>= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a >>>= b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_BitwiseXORAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a ^= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a ^= b");
+ }
+
+ //----------------------------------
+ // Comparison
+ //----------------------------------
+
+ @Test
+ public void testVisitBinaryOperatorNode_Equal()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a == b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a == b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_GreaterThan()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a > b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a > b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_GreaterThanEqual()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a >= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a >= b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_NotEqual()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a != b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a != b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_LessThan()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a < b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a < b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_LessThanEqual()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a <= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a <= b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_StrictEqual()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a === b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a === b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_StrictNotEqual()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a !== b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a !== b");
+ }
+
+ //----------------------------------
+ // Logical
+ //----------------------------------
+
+ @Test
+ public void testVisitBinaryOperatorNode_LogicalAnd()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a && b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a && b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_LogicalAndAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a &&= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a &&= b");
+ }
+
+ @Test
+ public void testVisitUnaryOperatorNode_LogicalNot()
+ {
+ IUnaryOperatorNode node = getUnaryNode("!a");
+ visitor.visitUnaryOperator(node);
+ assertOut("!a");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_LogicalOr()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a || b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a || b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_LogicalOrAssignment()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a ||= b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a ||= b");
+ }
+
+ //----------------------------------
+ // Other
+ //----------------------------------
+
+ @Test
+ public void testVisitDynamicAccessNode_1()
+ {
+ IDynamicAccessNode node = getDynamicAccessNode("a[b]");
+ visitor.visitDynamicAccess(node);
+ assertOut("a[b]");
+ }
+
+ @Test
+ public void testVisitDynamicAccessNode_2()
+ {
+ IDynamicAccessNode node = getDynamicAccessNode("a[b[c][d]]");
+ visitor.visitDynamicAccess(node);
+ assertOut("a[b[c][d]]");
+ }
+
+ @Test
+ public void testVisitAs()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a as b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a as b");
+ }
+
+ @Test
+ public void testVisitBinaryOperatorNode_Comma()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a, b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a, b");
+ }
+
+ @Test
+ public void testVisitTernaryOperatorNode()
+ {
+ ITernaryOperatorNode node = (ITernaryOperatorNode) getExpressionNode(
+ "a ? b : c", ITernaryOperatorNode.class);
+ visitor.visitTernaryOperator(node);
+ assertOut("a ? b : c");
+ }
+
+ @Test
+ public void testVisitUnaryOperator_Delete()
+ {
+ IUnaryOperatorNode node = getUnaryNode("delete a");
+ visitor.visitUnaryOperator(node);
+ assertOut("delete a");
+ }
+
+ @Test
+ public void testVisitMemberAccess_1()
+ {
+ IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getExpressionNode(
+ "a.b", IMemberAccessExpressionNode.class);
+ visitor.visitMemberAccessExpression(node);
+ assertOut("a.b");
+ }
+
+ @Test
+ public void testVisitMemberAccess_2()
+ {
+ IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getExpressionNode(
+ "a.b.c.d", IMemberAccessExpressionNode.class);
+ visitor.visitMemberAccessExpression(node);
+ assertOut("a.b.c.d");
+ }
+
+ @Test
+ public void testVisitBinaryOperator_In()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a in b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a in b");
+ }
+
+ @Test
+ public void testVisitBinaryOperator_Instancof()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a instanceof b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a instanceof b");
+ }
+
+ @Test
+ public void testVisitBinaryOperator_Is()
+ {
+ IBinaryOperatorNode node = getBinaryNode("a is b");
+ visitor.visitBinaryOperator(node);
+ assertOut("a is b");
+ }
+
+ @Test
+ public void testVisitBinaryOperator_NamespaceAccess_1()
+ {
+ // TODO this needs INamespaceAccessExpressionNode interface
+ NamespaceAccessExpressionNode node = (NamespaceAccessExpressionNode) getExpressionNode(
+ "a::b", NamespaceAccessExpressionNode.class);
+ visitor.visitNamespaceAccessExpression(node);
+ assertOut("a::b");
+ }
+
+ @Test
+ public void testVisitBinaryOperator_NamespaceAccess_2()
+ {
+ // TODO this needs INamespaceAccessExpressionNode interface
+ NamespaceAccessExpressionNode node = (NamespaceAccessExpressionNode) getExpressionNode(
+ "a::b::c", NamespaceAccessExpressionNode.class);
+ visitor.visitNamespaceAccessExpression(node);
+ assertOut("a::b::c");
+ }
+
+ @Test
+ public void testVisitBinaryOperator_New()
+ {
+ IFunctionCallNode node = (IFunctionCallNode) getExpressionNode(
+ "new Object()", IFunctionCallNode.class);
+ visitor.visitFunctionCall(node);
+ assertOut("new Object()");
+ }
+
+ @Test
+ public void testVisitObjectLiteral_1()
+ {
+ ObjectLiteralNode node = (ObjectLiteralNode) getExpressionNode(
+ "a = {a:1}", ObjectLiteralNode.class);
+ visitor.visitLiteral(node);
+ assertOut("{a:1}");
+ }
+
+ @Test
+ public void testVisitObjectLiteral_2()
+ {
+ ObjectLiteralNode node = (ObjectLiteralNode) getExpressionNode(
+ "a = {a:1,b:{c:2,d:{e:4}}}", ObjectLiteralNode.class);
+ visitor.visitLiteral(node);
+ assertOut("{a:1,b:{c:2,d:{e:4}}}");
+ }
+
+ @Test
+ public void testVisitArrayLiteral_1()
+ {
+ ArrayLiteralNode node = (ArrayLiteralNode) getExpressionNode(
+ "a = [0,1,2]", ArrayLiteralNode.class);
+ visitor.visitLiteral(node);
+ assertOut("[0,1,2]");
+ }
+
+ @Test
+ public void testVisitArrayLiteral_2()
+ {
+ ArrayLiteralNode node = (ArrayLiteralNode) getExpressionNode(
+ "a = [0,[0,1,[0,1]],2,[1,2]]", ArrayLiteralNode.class);
+ visitor.visitLiteral(node);
+ assertOut("[0,[0,1,[0,1]],2,[1,2]]");
+ }
+
+ @Test
+ public void testVisitUnaryOperatorNode_Typeof()
+ {
+ IUnaryOperatorNode node = getUnaryNode("typeof(a)");
+ visitor.visitUnaryOperator(node);
+ assertOut("typeof(a)");
+ }
+
+ @Test
+ public void testVisitUnaryOperatorNode_Void()
+ {
+ IUnaryOperatorNode node = getUnaryNode("void a");
+ visitor.visitUnaryOperator(node);
+ assertOut("void a");
+ }
+
+ @Test
+ public void testVisitUnaryOperatorNode_Concate_1()
+ {
+ IBinaryOperatorNode node = getBinaryNode("\"a\" + \"b\"");
+ visitor.visitBinaryOperator(node);
+ assertOut("\"a\" + \"b\"");
+ }
+
+ @Ignore
+ @Test
+ public void testVisitUnaryOperatorNode_Concate_2()
+ {
+ IBinaryOperatorNode node = getBinaryNode("\"a\\\"\" + \"\\\"b\"");
+ visitor.visitBinaryOperator(node);
+ assertOut("\"a\\\"\" + \"\\\"b\"");
+ }
+
+ @Test
+ public void testVisitIterationFlowNode_Break()
+ {
+ IIterationFlowNode node = (IIterationFlowNode) getNode("break",
+ IIterationFlowNode.class);
+ visitor.visitIterationFlow(node);
+ assertOut("break");
+ }
+
+ @Test
+ public void testVisitIterationFlowNode_Continue()
+ {
+ IIterationFlowNode node = (IIterationFlowNode) getNode("continue",
+ IIterationFlowNode.class);
+ visitor.visitIterationFlow(node);
+ assertOut("continue");
+ }
+
+ @Test
+ public void testVisitReturn()
+ {
+ IReturnNode node = (IReturnNode) getNode("return", IReturnNode.class);
+ visitor.visitReturn(node);
+ assertOut("return");
+ }
+
+ private void assertOut(String code)
+ {
+ assertThat(out.toString(), is(code));
+ }
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestExpressions.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestStatements.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestStatements.java?rev=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestStatements.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestStatements.java Thu Dec 13 23:32:01 2012
@@ -0,0 +1,373 @@
+/*
+ *
+ * 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.internal.tree.as.LabeledStatementNode;
+import org.apache.flex.compiler.tree.as.IFileNode;
+import org.apache.flex.compiler.tree.as.IForLoopNode;
+import org.apache.flex.compiler.tree.as.IIfNode;
+import org.apache.flex.compiler.tree.as.ISwitchNode;
+import org.apache.flex.compiler.tree.as.IThrowNode;
+import org.apache.flex.compiler.tree.as.ITryNode;
+import org.apache.flex.compiler.tree.as.IWhileLoopNode;
+import org.apache.flex.compiler.tree.as.IWithNode;
+import org.junit.Test;
+
+/**
+ * @author Michael Schmalle
+ */
+public class TestStatements extends TestWalkerBase
+{
+ //--------------------------------------------------------------------------
+ // if
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // if ()
+ //----------------------------------
+
+ @Test
+ public void testVisitIf_1()
+ {
+ IIfNode node = (IIfNode) getNode("if (a) b++;", IIfNode.class);
+ visitor.visitIf(node);
+ assertOut("if (a)\n\tb++;");
+ }
+
+ @Test
+ public void testVisitIf_2()
+ {
+ IIfNode node = (IIfNode) getNode("if (a) b++; else c++;", IIfNode.class);
+ visitor.visitIf(node);
+ assertOut("if (a)\n\tb++;\nelse\n\tc++;");
+ }
+
+ @Test
+ public void testVisitIf_4()
+ {
+ IIfNode node = (IIfNode) getNode(
+ "if (a) b++; else if (c) d++; else if(e) --f;", IIfNode.class);
+ visitor.visitIf(node);
+ assertOut("if (a)\n\tb++;\nelse if (c)\n\td++;\nelse if (e)\n\t--f;");
+ }
+
+ //----------------------------------
+ // if () { }
+ //----------------------------------
+
+ @Test
+ public void testVisitIf_1a()
+ {
+ IIfNode node = (IIfNode) getNode("if (a) { b++; }", IIfNode.class);
+ visitor.visitIf(node);
+ assertOut("if (a) {\n\tb++;\n}");
+ }
+
+ @Test
+ public void testVisitIf_1b()
+ {
+ IIfNode node = (IIfNode) getNode("if (a) { b++; } else { c++; }",
+ IIfNode.class);
+ visitor.visitIf(node);
+ assertOut("if (a) {\n\tb++;\n} else {\n\tc++;\n}");
+ }
+
+ @Test
+ public void testVisitIf_1c()
+ {
+ IIfNode node = (IIfNode) getNode(
+ "if (a) { b++; } else if (b) { c++; } else { d++; }",
+ IIfNode.class);
+ visitor.visitIf(node);
+ assertOut("if (a) {\n\tb++;\n} else if (b) {\n\tc++;\n} else {\n\td++;\n}");
+ }
+
+ @Test
+ public void testVisitIf_3()
+ {
+ IIfNode node = (IIfNode) getNode(
+ "if (a) b++; else if (c) d++; else --e;", IIfNode.class);
+ visitor.visitIf(node);
+ assertOut("if (a)\n\tb++;\nelse if (c)\n\td++;\nelse\n\t--e;");
+ }
+
+ //----------------------------------
+ // for () { }
+ //----------------------------------
+
+ @Test
+ public void testVisitFor_1a()
+ {
+ IForLoopNode node = (IForLoopNode) getNode(
+ "for (var i:int = 0; i < len; i++) { break; }",
+ IForLoopNode.class);
+ visitor.visitForLoop(node);
+ assertOut("for (var i:int = 0; i < len; i++) {\n\tbreak;\n}");
+ }
+
+ @Test
+ public void testVisitFor_1b()
+ {
+ IForLoopNode node = (IForLoopNode) getNode(
+ "for (var i:int = 0; i < len; i++) break;", IForLoopNode.class);
+ visitor.visitForLoop(node);
+ assertOut("for (var i:int = 0; i < len; i++)\n\tbreak;");
+ }
+
+ @Test
+ public void testVisitFor_2()
+ {
+ IForLoopNode node = (IForLoopNode) getNode("for (;;) { break; }",
+ IForLoopNode.class);
+ visitor.visitForLoop(node);
+ assertOut("for (;;) {\n\tbreak;\n}");
+ }
+
+ @Test
+ public void testVisitForIn_1()
+ {
+ IForLoopNode node = (IForLoopNode) getNode(
+ "for (var i:int in obj) { break; }", IForLoopNode.class);
+ visitor.visitForLoop(node);
+ assertOut("for (var i:int in obj) {\n\tbreak;\n}");
+ }
+
+ @Test
+ public void testVisitForIn_1a()
+ {
+ IForLoopNode node = (IForLoopNode) getNode(
+ "for (var i:int in obj) break; ", IForLoopNode.class);
+ visitor.visitForLoop(node);
+ assertOut("for (var i:int in obj)\n\tbreak;");
+ }
+
+ @Test
+ public void testVisitForEach_1()
+ {
+ IForLoopNode node = (IForLoopNode) getNode(
+ "for each(var i:int in obj) { break; }", IForLoopNode.class);
+ visitor.visitForLoop(node);
+ assertOut("for each (var i:int in obj) {\n\tbreak;\n}");
+ }
+
+ @Test
+ public void testVisitForEach_1a()
+ {
+ IForLoopNode node = (IForLoopNode) getNode(
+ "for each(var i:int in obj) break; ", IForLoopNode.class);
+ visitor.visitForLoop(node);
+ assertOut("for each (var i:int in obj)\n\tbreak;");
+ }
+
+ //----------------------------------
+ // while () { }
+ //----------------------------------
+
+ @Test
+ public void testVisitWhileLoop_1()
+ {
+ IWhileLoopNode node = (IWhileLoopNode) getNode(
+ "while(a > b){a++;--b;}", IWhileLoopNode.class);
+ visitor.visitWhileLoop(node);
+ assertOut("while (a > b) {\n\ta++;\n\t--b;\n}");
+ }
+
+ @Test
+ public void testVisitWhileLoop_1a()
+ {
+ IWhileLoopNode node = (IWhileLoopNode) getNode("while(a > b) a++;",
+ IWhileLoopNode.class);
+ visitor.visitWhileLoop(node);
+ assertOut("while (a > b)\n\ta++;");
+ }
+
+ //----------------------------------
+ // do {} while ()
+ //----------------------------------
+
+ @Test
+ public void testVisitWhileLoop_Do_1()
+ {
+ IWhileLoopNode node = (IWhileLoopNode) getNode(
+ "do {a++;--b;} while(a > b);", IWhileLoopNode.class);
+ visitor.visitWhileLoop(node);
+ assertOut("do {\n\ta++;\n\t--b;\n} while (a > b);");
+ }
+
+ @Test
+ public void testVisitWhileLoop_Do_1a()
+ {
+ IWhileLoopNode node = (IWhileLoopNode) getNode("do a++; while(a > b);",
+ IWhileLoopNode.class);
+ visitor.visitWhileLoop(node);
+ assertOut("do\n\ta++;\nwhile (a > b);");
+ }
+
+ //----------------------------------
+ // throw ()
+ //----------------------------------
+
+ @Test
+ public void testVisitThrow()
+ {
+ IThrowNode node = (IThrowNode) getNode("throw new Error('foo');",
+ IThrowNode.class);
+ visitor.visitThrow(node);
+ assertOut("throw new Error('foo')");
+ }
+
+ //----------------------------------
+ // try {} catch () {} finally {}
+ //----------------------------------
+
+ @Test
+ public void testVisitTry_Catch()
+ {
+ ITryNode node = (ITryNode) getNode("try { a; } catch (e:Error) { b; }",
+ ITryNode.class);
+ visitor.visitTry(node);
+ assertOut("try {\n\ta;\n} catch (e:Error) {\n\tb;\n}");
+ }
+
+ @Test
+ public void testVisitTry_Catch_Finally()
+ {
+ ITryNode node = (ITryNode) getNode(
+ "try { a; } catch (e:Error) { b; } finally { c; }",
+ ITryNode.class);
+ visitor.visitTry(node);
+ assertOut("try {\n\ta;\n} catch (e:Error) {\n\tb;\n} finally {\n\tc;\n}");
+ }
+
+ @Test
+ public void testVisitTry_Catch_Catch_Finally()
+ {
+ ITryNode node = (ITryNode) getNode(
+ "try { a; } catch (e:Error) { b; } catch (f:Error) { c; } finally { d; }",
+ ITryNode.class);
+ visitor.visitTry(node);
+ assertOut("try {\n\ta;\n} catch (e:Error) {\n\tb;\n} catch (f:Error) {\n\tc;\n} finally {\n\td;\n}");
+ }
+
+ @Test
+ public void testVisitTry_CatchEmpty_FinallyEmpty_()
+ {
+ ITryNode node = (ITryNode) getNode(
+ "try { a; } catch (e:Error) { } finally { }", ITryNode.class);
+ visitor.visitTry(node);
+ assertOut("try {\n\ta;\n} catch (e:Error) {\n} finally {\n}");
+ }
+
+ //----------------------------------
+ // switch {}
+ //----------------------------------
+
+ @Test
+ public void testVisitSwitch_1()
+ {
+ ISwitchNode node = (ISwitchNode) getNode("switch(i){case 1: break;}",
+ ISwitchNode.class);
+ visitor.visitSwitch(node);
+ assertOut("swtich (i) {\n\tcase 1:\n\t\tbreak;\n}");
+ }
+
+ @Test
+ public void testVisitSwitch_1a()
+ {
+ ISwitchNode node = (ISwitchNode) getNode(
+ "switch(i){case 1: { break; }}", ISwitchNode.class);
+ visitor.visitSwitch(node);
+ // TODO case BLOCK statements are SYNTHESIZED so they will never show BRACES
+ // without extra help from us
+ assertOut("swtich (i) {\n\tcase 1:\n\t\tbreak;\n}");
+ }
+
+ @Test
+ public void testVisitSwitch_2()
+ {
+ ISwitchNode node = (ISwitchNode) getNode(
+ "switch(i){case 1: break; default: return;}", ISwitchNode.class);
+ visitor.visitSwitch(node);
+ assertOut("swtich (i) {\n\tcase 1:\n\t\tbreak;\n\tdefault:\n\t\treturn;\n}");
+ }
+
+ //----------------------------------
+ // label : for () {}
+ //----------------------------------
+
+ @Test
+ public void testVisitLabel_1()
+ {
+ LabeledStatementNode node = (LabeledStatementNode) getNode(
+ "foo: for each(var i:int in obj) { break foo; }",
+ LabeledStatementNode.class);
+ visitor.visitLabeledStatement(node);
+ assertOut("foo : for each (var i:int in obj) {\n\tbreak foo;\n}");
+ }
+
+ @Test
+ public void testVisitLabel_1a()
+ {
+ // TODO LabelStatement messes up in finally{} block, something is wrong there
+ LabeledStatementNode node = (LabeledStatementNode) getNode(
+ "foo: for each(var i:int in obj) break foo;",
+ LabeledStatementNode.class);
+ visitor.visitLabeledStatement(node);
+ assertOut("foo : for each (var i:int in obj)\n\tbreak foo;");
+ }
+
+ //----------------------------------
+ // with () {}
+ //----------------------------------
+
+ @Test
+ public void testVisitWith()
+ {
+ IWithNode node = (IWithNode) getNode("with (a) { b; }", IWithNode.class);
+ visitor.visitWith(node);
+ assertOut("with (a) {\n\tb;\n}");
+ }
+
+ @Test
+ public void testVisitWith_1a()
+ {
+ IWithNode node = (IWithNode) getNode("with (a) b;", IWithNode.class);
+ visitor.visitWith(node);
+ assertOut("with (a)\n\tb;");
+ }
+
+ @Test
+ public void testVisit()
+ {
+ IFileNode node = (IFileNode) getNode(
+ "try { a; } catch (e:Error) { if (a) { if (b) { if (c) b; else if (f) a; else e; }} } finally { }"
+ + "if (d) for (var i:int = 0; i < len; i++) break;"
+ + "if (a) { with (ab) { c(); } "
+ + "do {a++;do a++; while(a > b);} while(c > d); }"
+ + "if (b) { try { a; throw new Error('foo'); } catch (e:Error) { "
+ + " switch(i){case 1: break; default: return;}"
+ + " } catch (f:Error) { c; eee.dd; } finally { "
+ + " d; eee.dd; eee.dd; eee.dd; eee.dd;} }"
+ + "foo: for each(var i:int in obj) break foo;",
+ IFileNode.class);
+ visitor.visitFile(node);
+ //assertOut("");
+ }
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestStatements.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: 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=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestWalkerBase.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestWalkerBase.java Thu Dec 13 23:32:01 2012
@@ -0,0 +1,52 @@
+package org.apache.flex.js.internal.driver;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.StringWriter;
+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.junit.After;
+
+public class TestWalkerBase extends TestBase
+{
+ protected IASBlockVisitor visitor;
+
+ private Writer out;
+
+ private IBackend backend;
+
+ private JSFilterWriter writer;
+
+ protected String mCode;
+
+ @Override
+ public void setUp()
+ {
+ super.setUp();
+
+ backend = new JSBackend();
+ out = new StringWriter();
+ writer = new JSFilterWriter(out);
+ visitor = backend.createWalker(project, errors, writer);
+ }
+
+ @After
+ public void tearDown()
+ {
+ backend = null;
+ out = null;
+ writer = null;
+ visitor = null;
+ }
+
+ protected void assertOut(String code)
+ {
+ mCode = out.toString();
+ assertThat(out.toString(), is(code));
+ }
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx.tests/src/org/apache/flex/js/internal/driver/TestWalkerBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.classpath
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.classpath?rev=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.classpath (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.classpath Thu Dec 13 23:32:01 2012
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/compiler"/>
+ <classpathentry kind="lib" path="lib/google/closure-compiler/compiler.jar"/>
+ <classpathentry kind="lib" path="lib/commons-io.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.classpath
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.project
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.project?rev=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.project (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.project Thu Dec 13 23:32:01 2012
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>compiler.jx</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/.project
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/README
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/README?rev=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/README (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/README Thu Dec 13 23:32:01 2012
@@ -0,0 +1,7 @@
+Apache FalconJx Prototype Cross Compiler
+====================
+
+- This needs to be more detailed.
+
+- Falcon needs to be built, see it's README
+- A temp folder needs to be created in the compiler.jx/temp
\ No newline at end of file
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/README
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java?rev=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java Thu Dec 13 23:32:01 2012
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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.clients;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.internal.js.codgen.ASBlockWalker;
+import org.apache.flex.compiler.internal.js.codgen.JSFilterWriter;
+import org.apache.flex.compiler.internal.js.codgen.JSWriter;
+import org.apache.flex.compiler.internal.projects.ISourceFileHandler;
+import org.apache.flex.compiler.internal.targets.JSTarget;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.projects.IASProject;
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.targets.ITargetProgressMonitor;
+import org.apache.flex.compiler.targets.ITargetSettings;
+import org.apache.flex.compiler.units.ICompilationUnit;
+
+/**
+ * The backend strategy for the {@link MXMLJSC} javascript compiler.
+ *
+ * @author Michael Schmalle
+ */
+public interface IBackend
+{
+ /**
+ * Returns the instance that is used to manage what type of
+ * {@link ICompilationUnit} is created during parsing.
+ *
+ * @return The implemented {@link ISourceFileHandler}.
+ */
+ ISourceFileHandler getSourceFileHandlerInstance();
+
+ /**
+ * Returns the {@link File} extension used when saving compiled code.
+ */
+ String getOutputExtension();
+
+ /**
+ * Creates a {@link Configurator} for the specific compile session.
+ */
+ Configurator createConfigurator();
+
+ /**
+ * Creates a javascript target that will be used to build the compiled
+ * javascript source file.
+ *
+ * @param project The current {@link ICompilerProject}.
+ * @param settings The target's custom settings.
+ * @param monitor The compilation monitor used during asynchronous parsing
+ * of {@link ICompilationUnit}s.
+ * @return A new {@link JSTarget} used during compilation.
+ */
+ JSTarget createJSTarget(IASProject project, ITargetSettings settings,
+ ITargetProgressMonitor monitor);
+
+ JSFilterWriter createFilterWriter(IASProject project);
+
+ JSWriter createWriter(IASProject project, List<ICompilerProblem> errors,
+ ICompilationUnit compilationUnit, boolean enableDebug);
+
+ ASBlockWalker createWalker(IASProject project,
+ List<ICompilerProblem> errors, JSFilterWriter writer);
+
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/IBackend.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: 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=1421615&view=auto
==============================================================================
--- incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/JSConfiguration.java (added)
+++ incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/JSConfiguration.java Thu Dec 13 23:32:01 2012
@@ -0,0 +1,52 @@
+/*
+ *
+ * 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.clients;
+
+import org.apache.flex.compiler.config.Configuration;
+import org.apache.flex.compiler.config.ConfigurationValue;
+import org.apache.flex.compiler.exceptions.ConfigurationException.BadValue;
+import org.apache.flex.compiler.internal.config.annotations.Config;
+import org.apache.flex.compiler.internal.config.annotations.Mapping;
+
+public class JSConfiguration extends Configuration
+{
+ public JSConfiguration()
+ {
+ }
+
+ //
+ // 'jasdoc.main-title' option
+ //
+
+ private String mainTitle;
+
+ public String getMainTitle()
+ {
+ return mainTitle;
+ }
+
+ @Config(allowMultiple = false)
+ @Mapping({ "jasdoc", "main-title" })
+ public void setMainTitle(ConfigurationValue cv, String value)
+ throws BadValue
+ {
+ mainTitle = value;
+ }
+}
Propchange: incubator/flex/whiteboard/mschmalle/falconjx/compiler.jx/src/org/apache/flex/compiler/clients/JSConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native