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/11/05 08:50:55 UTC
[13/23] git commit: [flex-falcon]
[refs/heads/feature-autobuild/example-maven-dirs] - - Greatly worked on
cleaning up the compiler code
- Greatly worked on cleaning up the compiler code
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/3724c2ff
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/3724c2ff
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/3724c2ff
Branch: refs/heads/feature-autobuild/example-maven-dirs
Commit: 3724c2ff9dfb33b2e343b0b82ee9486dbe5ea042
Parents: d5d4560
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Mon Oct 31 14:59:42 2016 +0100
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Mon Oct 31 14:59:42 2016 +0100
----------------------------------------------------------------------
.../apache/flex/compiler/clients/ASDOCJSC.java | 5 -
.../apache/flex/compiler/clients/COMPJSC.java | 5 -
.../apache/flex/compiler/clients/MXMLJSC.java | 51 +-
.../codegen/js/vf2js/IJSVF2JSEmitter.java | 30 -
.../internal/codegen/js/JSPublisher.java | 15 +-
.../codegen/js/goog/JSGoogPublisher.java | 125 +-
.../internal/codegen/js/goog/JarSourceFile.java | 6 +-
.../internal/codegen/js/jsc/JSCPublisher.java | 4 +-
.../codegen/js/jx/SuperCallEmitter.java | 97 +-
.../internal/codegen/js/node/NodePublisher.java | 4 +-
.../codegen/js/vf2js/JSVF2JSDocEmitter.java | 270 ---
.../codegen/js/vf2js/JSVF2JSEmitter.java | 1950 ------------------
.../mxml/flexjs/MXMLFlexJSPublisher.java | 262 +--
.../vf2js/MXMLVF2JSDescriptorSpecifier.java | 337 ---
.../codegen/mxml/vf2js/MXMLVF2JSEmitter.java | 1589 --------------
.../codegen/mxml/vf2js/MXMLVF2JSPublisher.java | 600 ------
.../driver/js/vf2js/JSVF2JSConfiguration.java | 86 -
.../internal/driver/js/vf2js/VF2JSBackend.java | 55 -
.../driver/mxml/vf2js/MXMLVF2JSBackend.java | 132 --
.../driver/mxml/vf2js/MXMLVF2JSSWCBackend.java | 121 --
.../internal/graph/VF2JSDepsWriter.java | 406 ----
.../utils/JSClosureCompilerWrapper.java | 4 +-
.../utils/VF2JSClosureCompilerWrapper.java | 224 --
.../flex/compiler/utils/VF2JSProjectUtils.java | 132 --
.../codegen/js/vf2js/TestVF2JSClass.java | 401 ----
.../codegen/js/vf2js/TestVF2JSExpressions.java | 124 --
.../codegen/js/vf2js/TestVF2JSFile.java | 92 -
.../codegen/js/vf2js/TestVF2JSProject.java | 131 --
.../codegen/js/vf2js/TestVF2JSStatements.java | 549 -----
.../mxml/vf2js/TestVF2JSMXMLApplication.java | 97 -
.../internal/test/VF2JSMXMLTestBase.java | 219 --
.../compiler/internal/test/VF2JSTestBase.java | 238 ---
.../src/test/resources/vf2js/files/SimpleAS.as | 43 -
.../resources/vf2js/files/SimpleAS_result.js | 72 -
.../test/resources/vf2js/files/SimpleMXML.mxml | 28 -
.../resources/vf2js/files/SimpleMXML_result.js | 67 -
.../src/test/resources/vf2js/files/Version.as | 25 -
.../resources/vf2js/projects/interfaces/Test.as | 46 -
.../vf2js/projects/interfaces/Test_result.js | 64 -
.../vf2js/projects/interfaces/classes/A.as | 32 -
.../projects/interfaces/classes/A_result.js | 51 -
.../vf2js/projects/interfaces/classes/B.as | 25 -
.../projects/interfaces/classes/B_result.js | 37 -
.../vf2js/projects/interfaces/classes/C.as | 25 -
.../projects/interfaces/classes/C_result.js | 37 -
.../vf2js/projects/interfaces/interfaces/IA.as | 22 -
.../projects/interfaces/interfaces/IA_result.js | 41 -
.../vf2js/projects/interfaces/interfaces/IB.as | 22 -
.../projects/interfaces/interfaces/IB_result.js | 38 -
.../vf2js/projects/interfaces/interfaces/IC.as | 22 -
.../projects/interfaces/interfaces/IC_result.js | 41 -
.../vf2js/projects/interfaces/interfaces/ID.as | 22 -
.../projects/interfaces/interfaces/ID_result.js | 38 -
.../vf2js/projects/interfaces/interfaces/IE.as | 26 -
.../projects/interfaces/interfaces/IE_result.js | 53 -
.../vf2js/projects/sdk/SomeSDKClass.as | 68 -
.../vf2js/projects/sdk/SomeSDKClass_result.js | 114 -
.../vf2js/projects/sdk/bases/HelperBaseClass.as | 33 -
.../sdk/bases/HelperBaseClass_result.js | 46 -
.../simpleMXML/src/SimpleMXML_Project.mxml | 37 -
.../simpleMXML/src/SimpleMXML_Project_result.js | 68 -
.../simpleMXML/src/example/Component.as | 31 -
.../simpleMXML/src/example/Component_result.js | 45 -
.../test/resources/vf2js/projects/super/Base.as | 65 -
.../vf2js/projects/super/Base_result.js | 120 --
.../resources/vf2js/projects/super/Super.as | 54 -
.../vf2js/projects/super/Super_result.js | 89 -
.../clients/problems/ProblemContext.java | 42 +
.../flex/compiler/config/Configuration.java | 5 +
.../src/main/java/flex2/tools/MxmlJSC.java | 4 -
70 files changed, 273 insertions(+), 9786 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/compiler-jx/src/main/java/org/apache/flex/compiler/clients/ASDOCJSC.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/ASDOCJSC.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/ASDOCJSC.java
index 8aa0552..abc9118 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/ASDOCJSC.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/ASDOCJSC.java
@@ -44,7 +44,6 @@ import org.apache.flex.compiler.internal.driver.js.goog.GoogBackend;
import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSASDocBackend;
import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSASDocDITABackend;
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.projects.FlexJSASDocProject;
import org.apache.flex.compiler.internal.targets.FlexJSSWCTarget;
@@ -144,10 +143,6 @@ public class ASDOCJSC extends MXMLJSC
backend = new GoogBackend();
break;
- case VF2JS:
- backend = new MXMLVF2JSSWCBackend();
- break;
-
default:
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/compiler-jx/src/main/java/org/apache/flex/compiler/clients/COMPJSC.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/COMPJSC.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/COMPJSC.java
index 97ba7c2..594ff45 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/COMPJSC.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/COMPJSC.java
@@ -49,7 +49,6 @@ 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.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.FlexJSSWCTarget;
import org.apache.flex.compiler.internal.targets.JSTarget;
@@ -146,10 +145,6 @@ public class COMPJSC extends MXMLJSC
backend = new GoogBackend();
break;
- case VF2JS:
- backend = new MXMLVF2JSSWCBackend();
- break;
-
default:
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
index 875439a..ac40089 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
@@ -57,7 +57,6 @@ import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
import org.apache.flex.compiler.internal.driver.js.jsc.JSCBackend;
import org.apache.flex.compiler.internal.driver.js.node.NodeBackend;
import org.apache.flex.compiler.internal.driver.mxml.flexjs.MXMLFlexJSBackend;
-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;
import org.apache.flex.compiler.internal.projects.FlexJSProject;
@@ -105,7 +104,6 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
AMD("amd"),
FLEXJS("flexjs"),
GOOG("goog"),
- VF2JS("vf2js"),
FLEXJS_DUAL("flexjs_dual"),
FLEXJS_DITA("flexjs_dita"),
JSC("jsc"),
@@ -227,9 +225,6 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
case GOOG:
backend = new GoogBackend();
break;
- case VF2JS:
- backend = new MXMLVF2JSBackend();
- break;
// if you add a new js-output-type here, don't forget to also add it
// to flex2.tools.MxmlJSC in flex-compiler-oem for IDE support
}
@@ -312,36 +307,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
ExitCode exitCode = ExitCode.SUCCESS;
try
{
- String[] adjustedArgs = args;
-
- if (jsOutputType != null)
- {
- switch (jsOutputType)
- {
- case VF2JS:
- boolean isFlashBuilderProject = useFlashBuilderProjectFiles(args);
-
- if (isFlashBuilderProject)
- {
- adjustedArgs = FlashBuilderConfigurator.computeFlashBuilderArgs(
- adjustedArgs, getTargetType().getExtension());
- }
-
- //String projectFilePath = adjustedArgs[adjustedArgs.length - 1];
- //
- //String newProjectFilePath = VF2JSProjectUtils
- // .createTempProject(projectFilePath,
- // isFlashBuilderProject);
- //
- //adjustedArgs[adjustedArgs.length - 1] = newProjectFilePath;
-
- break;
- default:
- break;
- }
- }
-
- final boolean continueCompilation = configure(adjustedArgs);
+ final boolean continueCompilation = configure(args);
// ToDo (erikdebruin): use JSSharedData for globals ...
keepASDoc = ((JSGoogConfiguration) config).getKeepASDoc();
@@ -407,20 +373,22 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
*/
protected boolean compile()
{
+ JSGoogConfiguration googConfiguration = (JSGoogConfiguration) config;
boolean compilationSuccess = false;
try
{
project.getSourceCompilationUnitFactory().addHandler(asFileHandler);
- if (!((JSGoogConfiguration) config).getSkipTranspile())
+ if (!googConfiguration.getSkipTranspile())
{
- if (!setupTargetFile())
- return false;
+ if (!setupTargetFile()) {
+ return false;
+ }
buildArtifact();
}
- if (jsTarget != null || ((JSGoogConfiguration) config).getSkipTranspile())
+ if (jsTarget != null || googConfiguration.getSkipTranspile())
{
List<ICompilerProblem> errors = new ArrayList<ICompilerProblem>();
List<ICompilerProblem> warnings = new ArrayList<ICompilerProblem>();
@@ -437,7 +405,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
File outputFolder = jsPublisher.getOutputFolder();
- if (!((JSGoogConfiguration) config).getSkipTranspile())
+ if (!googConfiguration.getSkipTranspile())
{
ArrayList<ICompilationUnit> roots = new ArrayList<ICompilationUnit>();
roots.add(mainCU);
@@ -739,8 +707,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
try
{
- if (useFlashBuilderProjectFiles(args)
- && !jsOutputType.equals(JSOutputType.VF2JS))
+ if (useFlashBuilderProjectFiles(args))
{
projectConfigurator.setConfiguration(
FlashBuilderConfigurator.computeFlashBuilderArgs(args,
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/vf2js/IJSVF2JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/vf2js/IJSVF2JSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/vf2js/IJSVF2JSEmitter.java
deleted file mode 100644
index cd4cacd..0000000
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/js/vf2js/IJSVF2JSEmitter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * 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.codegen.js.vf2js;
-
-import org.apache.flex.compiler.codegen.js.goog.IJSGoogEmitter;
-
-/**
- * @author Erik de Bruin
- */
-public interface IJSVF2JSEmitter extends IJSGoogEmitter
-{
-
-}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSPublisher.java
index cc49504..eaa8fe8 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSPublisher.java
@@ -22,6 +22,7 @@ package org.apache.flex.compiler.internal.codegen.js;
import java.io.File;
import java.io.IOException;
+import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.flex.compiler.clients.problems.ProblemQuery;
import org.apache.flex.compiler.codegen.js.IJSPublisher;
@@ -44,8 +45,9 @@ public class JSPublisher implements IJSPublisher
public File getOutputFolder()
{
outputFolder = new File(getOutputFilePath());
- if (!outputFolder.isDirectory())
+ if (!outputFolder.isDirectory()) {
outputFolder = outputFolder.getParentFile();
+ }
outputParentFolder = outputFolder;
@@ -56,11 +58,13 @@ public class JSPublisher implements IJSPublisher
protected void setupOutputFolder()
{
- if (outputParentFolder.exists())
- org.apache.commons.io.FileUtils.deleteQuietly(outputParentFolder);
+ if (outputParentFolder.exists()) {
+ FileUtils.deleteQuietly(outputParentFolder);
+ }
- if (!outputFolder.exists())
+ if (!outputFolder.exists()) {
outputFolder.mkdirs();
+ }
}
private String getOutputFilePath()
@@ -71,8 +75,9 @@ public class JSPublisher implements IJSPublisher
return FilenameUtils.removeExtension(configuration.getTargetFile())
.concat(extension);
}
- else
+ else {
return configuration.getOutput();
+ }
}
public boolean publish(ProblemQuery problems) throws IOException
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogPublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogPublisher.java
index 85abdef..6dbe8d7 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogPublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogPublisher.java
@@ -32,7 +32,6 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.apache.commons.io.filefilter.RegexFileFilter;
-import org.apache.flex.compiler.clients.JSConfiguration;
import org.apache.flex.compiler.clients.MXMLJSC.JSOutputType;
import org.apache.flex.compiler.clients.problems.ProblemQuery;
import org.apache.flex.compiler.codegen.js.IJSPublisher;
@@ -56,17 +55,19 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
public static final String GOOG_INTERMEDIATE_DIR_NAME = "js-intermediate";
public static final String GOOG_RELEASE_DIR_NAME = "js-release";
+ protected JSGoogConfiguration googConfiguration;
+
public JSGoogPublisher(Configuration config)
{
super(config);
+ googConfiguration = (JSGoogConfiguration) config;
}
@Override
public File getOutputFolder()
{
outputParentFolder = new File(configuration.getTargetFileDirectory()).getParentFile();
- outputFolder = new File(outputParentFolder,
- JSGoogPublisher.GOOG_INTERMEDIATE_DIR_NAME);
+ outputFolder = new File(outputParentFolder, JSGoogPublisher.GOOG_INTERMEDIATE_DIR_NAME);
setupOutputFolder();
@@ -86,37 +87,32 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
new File(intermediateDirPath).getParentFile(),
GOOG_RELEASE_DIR_NAME);
final String releaseDirPath = releaseDir.getPath();
- if (releaseDir.exists())
- org.apache.commons.io.FileUtils.deleteQuietly(releaseDir);
+ if (releaseDir.exists()) {
+ FileUtils.deleteQuietly(releaseDir);
+ }
releaseDir.mkdir();
- final String closureLibDirPath = ((JSGoogConfiguration) configuration).getClosureLib();
- final String closureGoogSrcLibDirPath = closureLibDirPath
- + "/closure/goog/";
- final String closureGoogTgtLibDirPath = intermediateDirPath
- + "/library/closure/goog";
- final String closureTPSrcLibDirPath = closureLibDirPath
- + "/third_party/closure/goog/";
- final String closureTPTgtLibDirPath = intermediateDirPath
- + "/library/third_party/closure/goog";
- final List<String> vanillaSDKSrcLibDirPath = ((JSGoogConfiguration) configuration).getSDKJSLib();
- final String vanillaSDKTgtLibDirPath = intermediateDirPath
- + "/VanillaSDK";
-
- final String depsSrcFilePath = intermediateDirPath
- + "/library/closure/goog/deps.js";
- final String depsTgtFilePath = intermediateDirPath + "/deps.js";
- final String projectIntermediateJSFilePath = intermediateDirPath
- + File.separator + outputFileName;
- final String projectReleaseJSFilePath = releaseDirPath + File.separator
- + outputFileName;
-
- appendExportSymbol(projectIntermediateJSFilePath, projectName);
-
- copyFile(vanillaSDKSrcLibDirPath.get(0), vanillaSDKTgtLibDirPath);
+ final File closureLibDir = new File(googConfiguration.getClosureLib());
+ final File closureGoogSrcLibDir = new File(closureLibDir, "/closure/goog/");
+ final File closureGoogTgtLibDir = new File(intermediateDirPath, "/library/closure/goog");
+ final File closureTPSrcLibDir = new File(closureLibDir, "/third_party/closure/goog/");
+ final File closureTPTgtLibDir = new File(intermediateDirPath, "/library/third_party/closure/goog");
+ // FIXME: What's the VanillaSDK?
+ final List<String> vanillaSDKSrcLibDirPath = googConfiguration.getSDKJSLib();
+ final File vanillaSDKTgtLibDir = new File(intermediateDirPath, "/VanillaSDK");
+
+ final File depsSrcFile = new File(intermediateDirPath, "/library/closure/goog/deps.js");
+ final File depsTgtFile = new File(intermediateDirPath, "/deps.js");
+ final File projectIntermediateJSFile = new File(intermediateDirPath, outputFileName);
+ final File projectReleaseJSFile = new File(releaseDirPath, outputFileName);
+
+ appendExportSymbol(projectIntermediateJSFile, projectName);
+
+ // FIXME: What's the VanillaSDK?
+ copyFile(new File(vanillaSDKSrcLibDirPath.get(0)), vanillaSDKTgtLibDir);
List<SourceFile> inputs = new ArrayList<SourceFile>();
- Collection<File> files = org.apache.commons.io.FileUtils.listFiles(
+ Collection<File> files = FileUtils.listFiles(
new File(intermediateDirPath),
new RegexFileFilter("^.*(\\.js)"),
DirectoryFileFilter.DIRECTORY);
@@ -125,28 +121,26 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
inputs.add(SourceFile.fromFile(file));
}
- copyFile(closureGoogSrcLibDirPath, closureGoogTgtLibDirPath);
- copyFile(closureTPSrcLibDirPath, closureTPTgtLibDirPath);
+ copyFile(closureGoogSrcLibDir, closureGoogTgtLibDir);
+ copyFile(closureTPSrcLibDir, closureTPTgtLibDir);
- File srcDeps = new File(depsSrcFilePath);
+ File srcDeps = depsSrcFile;
final List<SourceFile> deps = new ArrayList<SourceFile>();
deps.add(SourceFile.fromFile(srcDeps));
ErrorManager errorManager = new JSGoogErrorManager();
DepsGenerator depsGenerator = new DepsGenerator(deps, inputs,
- InclusionStrategy.ALWAYS, closureGoogTgtLibDirPath,
+ InclusionStrategy.ALWAYS, closureGoogTgtLibDir.getCanonicalPath(),
errorManager);
- writeFile(depsTgtFilePath, depsGenerator.computeDependencyCalls(),
- false);
+ writeFile(depsTgtFile, depsGenerator.computeDependencyCalls(),false);
- org.apache.commons.io.FileUtils.deleteQuietly(srcDeps);
- org.apache.commons.io.FileUtils.moveFile(new File(depsTgtFilePath),
- srcDeps);
+ FileUtils.deleteQuietly(srcDeps);
+ FileUtils.moveFile(depsTgtFile, srcDeps);
// XXX (mschmalle) until we figure out what is going on with this configuration, just skip
// HTML generation for JSC output type
- String outputType = ((JSConfiguration) configuration).getJSOutputType();
+ String outputType = googConfiguration.getJSOutputType();
if (!outputType.equals(JSOutputType.JSC.getText()))
{
writeHTML("intermediate", projectName, intermediateDirPath);
@@ -155,7 +149,7 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
ArrayList<String> optionList = new ArrayList<String>();
- files = org.apache.commons.io.FileUtils.listFiles(new File(
+ files = FileUtils.listFiles(new File(
intermediateDirPath), new RegexFileFilter("^.*(\\.js)"),
DirectoryFileFilter.DIRECTORY);
for (File file : files)
@@ -166,10 +160,10 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
optionList.add("--closure_entry_point=" + projectName);
optionList.add("--only_closure_dependencies");
optionList.add("--compilation_level=ADVANCED_OPTIMIZATIONS");
- optionList.add("--js_output_file=" + projectReleaseJSFilePath);
+ optionList.add("--js_output_file=" + projectReleaseJSFile);
optionList.add("--output_manifest=" + releaseDirPath + File.separator
+ "manifest.txt");
- optionList.add("--create_source_map=" + projectReleaseJSFilePath
+ optionList.add("--create_source_map=" + projectReleaseJSFile
+ ".map");
optionList.add("--source_map_format=" + SourceMap.Format.V3);
@@ -177,7 +171,7 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
JSClosureCompilerUtil.run(options);
- appendSourceMapLocation(projectReleaseJSFilePath, projectName);
+ appendSourceMapLocation(projectReleaseJSFile, projectName);
System.out.println("The project '" + projectName
+ "' has been successfully compiled and optimized.");
@@ -185,7 +179,7 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
return true;
}
- private void appendExportSymbol(String path, String projectName)
+ private void appendExportSymbol(File targetFile, String projectName)
throws IOException
{
StringBuilder appendString = new StringBuilder();
@@ -195,10 +189,10 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
appendString.append("', ");
appendString.append(projectName);
appendString.append(");\n");
- writeFile(path, appendString.toString(), true);
+ writeFile(targetFile, appendString.toString(), true);
}
- protected void appendSourceMapLocation(String path, String projectName)
+ protected void appendSourceMapLocation(File path, String projectName)
throws IOException
{
StringBuilder appendString = new StringBuilder();
@@ -207,14 +201,13 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
writeFile(path, appendString.toString(), true);
}
- protected void copyFile(String srcPath, String tgtPath) throws IOException
+ protected void copyFile(File source, File target) throws IOException
{
- File srcFile = new File(srcPath);
- if (srcFile.isDirectory())
- org.apache.commons.io.FileUtils.copyDirectory(srcFile, new File(
- tgtPath));
- else
- org.apache.commons.io.FileUtils.copyFile(srcFile, new File(tgtPath));
+ if (source.isDirectory()) {
+ FileUtils.copyDirectory(source, target);
+ } else {
+ FileUtils.copyFile(source, target);
+ }
}
protected void writeHTML(String type, String projectName, String dirPath)
@@ -253,28 +246,26 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
htmlFile.append("</body>\n");
htmlFile.append("</html>");
- writeFile(dirPath + File.separator + "index.html", htmlFile.toString(),
- false);
+ writeFile(new File(dirPath, "index.html"), htmlFile.toString(),false);
}
- protected void writeFile(String path, String content, boolean append)
+ protected void writeFile(File target, String content, boolean append)
throws IOException
{
- File tgtFile = new File(path);
-
- if (!tgtFile.exists())
- tgtFile.createNewFile();
+ if (!target.exists()) {
+ target.createNewFile();
+ }
- FileWriter fw = new FileWriter(tgtFile, append);
+ FileWriter fw = new FileWriter(target, append);
fw.write(content);
fw.close();
}
- protected List<SourceFile> addClasspathResources(File jarFile) throws IOException {
- return addClasspathResources(jarFile, null);
+ protected List<SourceFile> getClasspathResources(File jarFile) throws IOException {
+ return getClasspathResources(jarFile, null);
}
- protected List<SourceFile> addClasspathResources(File jarFile, Properties whiteList) throws IOException {
+ protected List<SourceFile> getClasspathResources(File jarFile, Properties whiteList) throws IOException {
List<SourceFile> sourceFiles = new LinkedList<SourceFile>();
JarFile jar = null;
@@ -302,10 +293,10 @@ public class JSGoogPublisher extends JSPublisher implements IJSPublisher
return sourceFiles;
}
- protected List<SourceFile> addDirectoryResources(File directory) throws IOException {
+ protected List<SourceFile> getDirectoryResources(File directory) throws IOException {
List<SourceFile> sourceFiles = new LinkedList<SourceFile>();
- Collection<File> files = org.apache.commons.io.FileUtils.listFiles(directory,
+ Collection<File> files = FileUtils.listFiles(directory,
new RegexFileFilter("^.*(\\.js)"), DirectoryFileFilter.DIRECTORY);
for (File file : files)
{
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JarSourceFile.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JarSourceFile.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JarSourceFile.java
index 8db5bc9..327df22 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JarSourceFile.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JarSourceFile.java
@@ -96,17 +96,17 @@ public class JarSourceFile extends SourceFile {
@Override
public int getColumnOfOffset(int offset) {
- throw new RuntimeException("Not implemented");
+ return super.getColumnOfOffset(offset);
}
@Override
public String getLine(int lineNumber) {
- throw new RuntimeException("Not implemented");
+ return super.getLine(lineNumber);
}
@Override
public Region getRegion(int lineNumber) {
- throw new RuntimeException("Not implemented");
+ return super.getRegion(lineNumber);
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/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 21c456c..3399269 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
@@ -62,7 +62,7 @@ public class JSCPublisher extends MXMLFlexJSPublisher
}
@Override
- protected void writeHTML(String type, String projectName, String dirPath,
+ protected void writeHTML(String type, String projectName, File targetDir,
String deps, List<String> additionalHTML) throws IOException
{
if ("intermediate".equals(type))
@@ -72,7 +72,7 @@ public class JSCPublisher extends MXMLFlexJSPublisher
depsFile.append("goog.require(\"");
depsFile.append(projectName);
depsFile.append("\");\n");
- writeFile(dirPath + File.separator + projectName + "-dependencies.js", depsFile.toString(), false);
+ writeFile(new File(targetDir, projectName + "-dependencies.js"), depsFile.toString(), false);
}
//don't call super.writeHTML() because asjsc defaults to no HTML
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/SuperCallEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/SuperCallEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/SuperCallEmitter.java
index 12dc411..7be2c42 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/SuperCallEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/SuperCallEmitter.java
@@ -19,8 +19,6 @@
package org.apache.flex.compiler.internal.codegen.js.jx;
-import org.apache.flex.compiler.clients.MXMLJSC;
-import org.apache.flex.compiler.clients.MXMLJSC.JSOutputType;
import org.apache.flex.compiler.codegen.js.IJSEmitter;
import org.apache.flex.compiler.definitions.IClassDefinition;
import org.apache.flex.compiler.definitions.IDefinition;
@@ -33,7 +31,6 @@ import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens
import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
-import org.apache.flex.compiler.internal.tree.as.BinaryOperatorAssignmentNode;
import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
import org.apache.flex.compiler.internal.tree.as.MemberAccessExpressionNode;
@@ -61,43 +58,42 @@ public class SuperCallEmitter extends JSSubEmitter
final IClassDefinition thisClass = getModel().getCurrentClass();
- if (type == JSSessionModel.SUPER_FUNCTION_CALL)
+ if (JSSessionModel.SUPER_FUNCTION_CALL.equals(type))
{
- if (fnode == null)
- fnode = (IFunctionNode) fcnode
- .getAncestorOfType(IFunctionNode.class);
+ // FIXME: This is obviously wrong.
+ /*if (fnode == null) {
+ fnode = (IFunctionNode) fcnode.getAncestorOfType(IFunctionNode.class);
+ }*/
if (fnode != null && fnode.isConstructor()
- && !EmitterUtils.hasSuperClass(getProject(), fnode))
+ && !EmitterUtils.hasSuperClass(getProject(), fnode)) {
return;
+ }
- IClassNode cnode = (IClassNode) node
- .getAncestorOfType(IClassNode.class);
-
- // ToDo (erikdebruin): add VF2JS conditional -> only use check during full SDK compilation
- if (cnode == null && MXMLJSC.jsOutputType == JSOutputType.VF2JS)
- return;
+ IClassNode cnode = (IClassNode) node.getAncestorOfType(IClassNode.class);
if (fnode != null
&& (fnode.getNodeID() == ASTNodeID.GetterID || fnode
.getNodeID() == ASTNodeID.SetterID))
{
- if (cnode == null && thisClass != null)
+ if (cnode == null && thisClass != null) {
write(getEmitter().formatQualifiedName(
thisClass.getQualifiedName()));
- else
+ } else if(cnode != null) {
write(getEmitter().formatQualifiedName(
cnode.getQualifiedName()));
+ }
write(ASEmitterTokens.MEMBER_ACCESS);
write(JSGoogEmitterTokens.GOOG_BASE);
write(ASEmitterTokens.PAREN_OPEN);
write(ASEmitterTokens.THIS);
writeToken(ASEmitterTokens.COMMA);
write(ASEmitterTokens.SINGLE_QUOTE);
- if (fnode.getNodeID() == ASTNodeID.GetterID)
+ if (fnode.getNodeID() == ASTNodeID.GetterID) {
write(JSFlexJSEmitterTokens.GETTER_PREFIX);
- else
+ } else {
write(JSFlexJSEmitterTokens.SETTER_PREFIX);
+ }
write(fnode.getName());
write(ASEmitterTokens.SINGLE_QUOTE);
@@ -109,35 +105,19 @@ public class SuperCallEmitter extends JSSubEmitter
writeArguments = anodes.length > 0;
}
- else if (fnode != null && fnode.isConstructor())
+ else if (fnode.isConstructor())
{
anodes = fnode.getParameterNodes();
writeArguments = (anodes != null && anodes.length > 0);
}
- else if (node instanceof IFunctionNode
- && node instanceof BinaryOperatorAssignmentNode)
- {
- BinaryOperatorAssignmentNode bnode = (BinaryOperatorAssignmentNode) node;
-
- IFunctionNode pnode = (IFunctionNode) bnode
- .getAncestorOfType(IFunctionNode.class);
-
- if (pnode.getNodeID() == ASTNodeID.SetterID)
- {
- writeToken(ASEmitterTokens.COMMA);
- getWalker().walk(bnode.getRightOperandNode());
- }
- }
if (writeArguments)
{
- int len = anodes.length;
- for (int i = 0; i < len; i++)
- {
+ for (IASNode anode : anodes) {
writeToken(ASEmitterTokens.COMMA);
- getWalker().walk(anodes[i]);
+ getWalker().walk(anode);
}
}
@@ -153,38 +133,37 @@ public class SuperCallEmitter extends JSSubEmitter
// TODO (mschmalle) will remove this cast as more things get abstracted
JSFlexJSEmitter fjs = (JSFlexJSEmitter) getEmitter();
- IFunctionNode fnode = (node instanceof IFunctionNode) ? (IFunctionNode) node
- : null;
- IFunctionCallNode fcnode = (node instanceof IFunctionCallNode) ? (FunctionCallNode) node
- : null;
+ IFunctionNode fnode = (node instanceof IFunctionNode) ? (IFunctionNode) node : null;
+ IFunctionCallNode fcnode = (node instanceof IFunctionCallNode) ? (FunctionCallNode) node : null;
- if (type == JSSessionModel.CONSTRUCTOR_EMPTY)
+ if (JSSessionModel.CONSTRUCTOR_EMPTY.equals(type))
{
indentPush();
writeNewline();
indentPop();
}
- else if (type == JSSessionModel.SUPER_FUNCTION_CALL)
+ else if (JSSessionModel.SUPER_FUNCTION_CALL.equals(type))
{
- if (fnode == null)
- fnode = (IFunctionNode) fcnode
- .getAncestorOfType(IFunctionNode.class);
+ // FIXME: This is obviously wrong.
+ if (fnode == null) {
+ fnode = (IFunctionNode) fcnode.getAncestorOfType(IFunctionNode.class);
+ }
}
- if (fnode.isConstructor()
- && !EmitterUtils.hasSuperClass(getProject(), fnode))
+ if (fnode.isConstructor() && !EmitterUtils.hasSuperClass(getProject(), fnode)) {
return;
+ }
- IClassNode cnode = (IClassNode) node
- .getAncestorOfType(IClassNode.class);
+ IClassNode cnode = (IClassNode) node.getAncestorOfType(IClassNode.class);
if (cnode == null)
{
IDefinition cdef = getModel().getCurrentClass();
write(fjs.formatQualifiedName(cdef.getQualifiedName()));
}
- else
+ else {
write(fjs.formatQualifiedName(cnode.getQualifiedName()));
+ }
write(ASEmitterTokens.MEMBER_ACCESS);
write(JSGoogEmitterTokens.GOOG_BASE);
write(ASEmitterTokens.PAREN_OPEN);
@@ -198,7 +177,7 @@ public class SuperCallEmitter extends JSSubEmitter
write(ASEmitterTokens.SINGLE_QUOTE);
}
- if (fnode != null && !fnode.isConstructor())
+ if (!fnode.isConstructor())
{
writeToken(ASEmitterTokens.COMMA);
write(ASEmitterTokens.SINGLE_QUOTE);
@@ -213,9 +192,9 @@ public class SuperCallEmitter extends JSSubEmitter
superName = ((IdentifierNode)namenode).getName();
}
}
- if (def instanceof FunctionDefinition && fjs.isCustomNamespace((FunctionDefinition)def))
+ if (def instanceof FunctionDefinition && fjs.isCustomNamespace((FunctionDefinition) def))
{
- INamespaceDefinition nsDef = ((FunctionDefinition)def).getNamespaceReference().resolveNamespaceReference(getProject());
+ INamespaceDefinition nsDef = def.getNamespaceReference().resolveNamespaceReference(getProject());
if (nsDef.getContainingScope() != null) // was null for flash_proxy in unit test
fjs.formatQualifiedName(nsDef.getQualifiedName()); // register with used names
String s = nsDef.getURI();
@@ -249,23 +228,21 @@ public class SuperCallEmitter extends JSSubEmitter
if (writeArguments)
{
- int len = anodes.length;
- for (int i = 0; i < len; i++)
- {
+ for (IASNode anode : anodes) {
writeToken(ASEmitterTokens.COMMA);
- getWalker().walk(anodes[i]);
+ getWalker().walk(anode);
}
}
write(ASEmitterTokens.PAREN_CLOSE);
- if (type == JSSessionModel.CONSTRUCTOR_FULL)
+ if (JSSessionModel.CONSTRUCTOR_FULL.equals(type))
{
write(ASEmitterTokens.SEMICOLON);
writeNewline();
}
- else if (type == JSSessionModel.CONSTRUCTOR_EMPTY)
+ else if (JSSessionModel.CONSTRUCTOR_EMPTY.equals(type))
{
write(ASEmitterTokens.SEMICOLON);
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/node/NodePublisher.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/node/NodePublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/node/NodePublisher.java
index cf3a99e..d4b26a8 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/node/NodePublisher.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/node/NodePublisher.java
@@ -70,12 +70,12 @@ public class NodePublisher extends JSCPublisher
}
@Override
- protected void writeHTML(String type, String projectName, String dirPath,
+ protected void writeHTML(String type, String projectName, File targetDir,
String deps, List<String> additionalHTML) throws IOException
{
StringBuilder contents = new StringBuilder();
contents.append(getTemplateDependencies(type, projectName, deps));
contents.append(getTemplateBody(projectName));
- writeFile(dirPath + File.separator + "index.js", contents.toString(), false);
+ writeFile(new File(targetDir, "index.js"), contents.toString(), false);
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3724c2ff/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSDocEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSDocEmitter.java
deleted file mode 100644
index 3147c20..0000000
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSDocEmitter.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- *
- * 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.vf2js;
-
-import org.apache.flex.compiler.asdoc.flexjs.ASDocComment;
-import org.apache.flex.compiler.clients.MXMLJSC;
-import org.apache.flex.compiler.codegen.js.IJSEmitter;
-import org.apache.flex.compiler.common.ASModifier;
-import org.apache.flex.compiler.common.DependencyType;
-import org.apache.flex.compiler.constants.IASKeywordConstants;
-import org.apache.flex.compiler.constants.IASLanguageConstants;
-import org.apache.flex.compiler.definitions.IClassDefinition;
-import org.apache.flex.compiler.definitions.IDefinition;
-import org.apache.flex.compiler.definitions.IFunctionDefinition;
-import org.apache.flex.compiler.definitions.ITypeDefinition;
-import org.apache.flex.compiler.definitions.references.IReference;
-import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
-import org.apache.flex.compiler.internal.codegen.js.JSEmitterTokens;
-import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogDocEmitter;
-import org.apache.flex.compiler.internal.definitions.InterfaceDefinition;
-import org.apache.flex.compiler.internal.scopes.ASScope;
-import org.apache.flex.compiler.projects.ICompilerProject;
-import org.apache.flex.compiler.tree.as.IDefinitionNode;
-import org.apache.flex.compiler.tree.as.IExpressionNode;
-import org.apache.flex.compiler.tree.as.IFunctionNode;
-import org.apache.flex.compiler.tree.as.IParameterNode;
-import org.apache.flex.compiler.tree.as.IVariableNode;
-
-public class JSVF2JSDocEmitter extends JSGoogDocEmitter
-{
-
- public JSVF2JSDocEmitter(IJSEmitter emitter)
- {
- super(emitter);
- }
-
- @Override
- public void emitMethodDoc(IFunctionNode node, ICompilerProject project)
- {
- IClassDefinition classDefinition = resolveClassDefinition(node);
-
- ASDocComment asDoc = (ASDocComment) node.getASDocComment();
-
- if (node instanceof IFunctionNode)
- {
- boolean hasDoc = false;
-
- if (node.isConstructor())
- {
- if (asDoc != null && MXMLJSC.keepASDoc)
- write(asDoc.commentNoEnd());
- else
- begin();
- hasDoc = true;
-
- emitJSDocLine(JSEmitterTokens.CONSTRUCTOR);
-
- IClassDefinition parent = (IClassDefinition) node
- .getDefinition().getParent();
- IClassDefinition superClass = parent.resolveBaseClass(project);
- String qname = (superClass != null) ? superClass.getQualifiedName() : null;
-
- if (superClass != null
- && !qname.equals(IASLanguageConstants.Object))
- emitExtends(superClass, superClass.getPackageName());
-
- IReference[] references = classDefinition
- .getImplementedInterfaceReferences();
- for (IReference iReference : references)
- {
- ITypeDefinition type = (ITypeDefinition) iReference
- .resolve(project, (ASScope) classDefinition
- .getContainingScope(),
- DependencyType.INHERITANCE, true);
- if (type == null)
- System.out.println(iReference.getDisplayString() + " not resolved in " + classDefinition.getQualifiedName());
- emitImplements(type, type.getPackageName());
- }
- }
- else
- {
- String ns = node.getNamespace();
- if (ns != null)
- {
- if (asDoc != null && MXMLJSC.keepASDoc)
- write(asDoc.commentNoEnd());
- else
- begin();
- emitMethodAccess(node);
- hasDoc = true;
- }
- }
-
- // @param
- IParameterNode[] parameters = node.getParameterNodes();
- for (IParameterNode pnode : parameters)
- {
- if (!hasDoc)
- {
- if (asDoc != null && MXMLJSC.keepASDoc)
- write(asDoc.commentNoEnd());
- else
- begin();
- emitMethodAccess(node);
- hasDoc = true;
- }
-
- IExpressionNode enode = pnode.getNameExpressionNode();
-
- // ToDo (erikdebruin): add VF2JS conditional -> only use check during full SDK compilation
- ITypeDefinition tdef = enode.resolveType(project);
- if (tdef == null)
- continue;
-
- emitParam(pnode, tdef.getPackageName());
- }
-
- if (!node.isConstructor())
- {
- // @return
- String returnType = node.getReturnType();
- if (returnType != ""
- && returnType != ASEmitterTokens.VOID.getToken())
- {
- if (!hasDoc)
- {
- if (asDoc != null && MXMLJSC.keepASDoc)
- write(asDoc.commentNoEnd());
- else
- begin();
- emitMethodAccess(node);
- hasDoc = true;
- }
-
- ITypeDefinition tdef = ((IFunctionDefinition)node.getDefinition())
- .resolveReturnType(project);
-
- String packageName = "";
- if (tdef instanceof InterfaceDefinition)
- packageName = tdef.getPackageName();
- else
- packageName = node.getPackageName();
-
- emitReturn(node, packageName);
- }
-
- // @override
- Boolean override = node.hasModifier(ASModifier.OVERRIDE);
- if (override)
- {
- if (!hasDoc)
- {
- if (asDoc != null && MXMLJSC.keepASDoc)
- write(asDoc.commentNoEnd());
- else
- begin();
- emitMethodAccess(node);
- hasDoc = true;
- }
-
- emitOverride(node);
- }
- }
-
- if (hasDoc)
- end();
- }
- }
-
- @Override
- public void emitVarDoc(IVariableNode node, IDefinition def, ICompilerProject project)
- {
- String packageName = "";
- if (def != null)
- packageName = def.getPackageName();
-
- if (!node.isConst())
- {
- IDefinition ndef = node.getDefinition();
- if (emitter != null && emitter instanceof JSVF2JSEmitter)
- {
- if (project != null)
- {
- packageName = ((ITypeDefinition)ndef.resolveType(project))
- .getPackageName();
- }
- }
- }
-
- emitTypeShort(node, packageName);
- }
-
-
- public void emitInterfaceMemberDoc(IDefinitionNode node, ICompilerProject project)
- {
- boolean hasDoc = false;
-
- ASDocComment asDoc = (ASDocComment) ((IFunctionNode) node).getASDocComment();
-
- String returnType = ((IFunctionNode) node).getReturnType();
- if (returnType != ""
- && returnType != ASEmitterTokens.VOID.getToken()) // has return
- {
- if (asDoc != null && MXMLJSC.keepASDoc)
- write(asDoc.commentNoEnd());
- else
- begin();
- hasDoc = true;
-
- ITypeDefinition tdef = ((IFunctionDefinition)node.getDefinition())
- .resolveReturnType(project);
-
- emitReturn((IFunctionNode) node, tdef.getPackageName());
- }
-
- IParameterNode[] parameters = ((IFunctionNode) node).getParameterNodes();
- for (IParameterNode pnode : parameters)
- {
- if (!hasDoc)
- {
- if (asDoc != null && MXMLJSC.keepASDoc)
- write(asDoc.commentNoEnd());
- else
- begin();
- hasDoc = true;
- }
-
- IExpressionNode enode = pnode.getNameExpressionNode();
- emitParam(pnode, enode.resolveType(project).getPackageName());
- }
-
- if (hasDoc)
- end();
- }
-
- @Override
- public void emitMethodAccess(IFunctionNode node)
- {
- String ns = node.getNamespace();
- if (ns == IASKeywordConstants.PRIVATE)
- {
- emitPrivate(node);
- }
- else if (ns == IASKeywordConstants.PROTECTED)
- {
- emitProtected(node);
- }
- else if (ns == IASKeywordConstants.PUBLIC)
- {
- emitPublic(node);
- }
- }
-}