You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2016/01/11 19:04:44 UTC
[1/9] git commit: [flex-falcon] [refs/heads/develop] - changes to
generate the set of requires based on actual usage instead of the
dependencies requires by AS. AS dependencies may also include types of
variables which don't really matter to JS. Doing
Repository: flex-falcon
Updated Branches:
refs/heads/develop 0c69c38ad -> f3f082fa3
changes to generate the set of requires based on actual usage instead of the dependencies requires by AS. AS dependencies may also include types of variables which don't really matter to JS. Doing this eliminates the need for circular dependency checking in our code. But it also seems to have caused new warnings to show up which will require more investigation and a future commit
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/15b170f8
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/15b170f8
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/15b170f8
Branch: refs/heads/develop
Commit: 15b170f8d133dc03580a47ac95c4624b81bcb28a
Parents: 9d605f2
Author: Alex Harui <ah...@apache.org>
Authored: Thu Jan 7 10:28:25 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Jan 7 10:28:25 2016 -0800
----------------------------------------------------------------------
.../flex/compiler/codegen/as/IASEmitter.java | 2 +
.../compiler/codegen/mxml/IMXMLEmitter.java | 2 +
.../compiler/internal/codegen/as/ASEmitter.java | 6 +++
.../compiler/internal/codegen/js/JSWriter.java | 2 +-
.../codegen/js/flexjs/JSFlexJSDocEmitter.java | 2 +-
.../codegen/js/flexjs/JSFlexJSEmitter.java | 46 +++++++++++++++++++-
.../codegen/js/jx/IdentifierEmitter.java | 5 ++-
.../codegen/js/jx/PackageFooterEmitter.java | 4 +-
.../internal/codegen/mxml/MXMLEmitter.java | 6 +++
.../internal/codegen/mxml/MXMLWriter.java | 2 +-
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 35 +++++++++++++++
.../compiler/internal/graph/GoogDepsWriter.java | 4 +-
12 files changed, 109 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
index df9bbcc..1a666f1 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
@@ -85,6 +85,8 @@ public interface IASEmitter extends IEmitter
void setDocEmitter(IDocEmitter value);
+ String postProcess(String output);
+
void emitImport(IImportNode node);
void emitPackageHeader(IPackageDefinition definition);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/codegen/mxml/IMXMLEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/mxml/IMXMLEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/mxml/IMXMLEmitter.java
index 53461b4..a8dc6dc 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/mxml/IMXMLEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/mxml/IMXMLEmitter.java
@@ -60,6 +60,8 @@ public interface IMXMLEmitter extends IEmitter
IBlockWalker getMXMLWalker();
+ String postProcess(String output);
+
void setMXMLWalker(IBlockWalker mxmlBlockWalker);
//--------------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
index 8223ee9..ca21571 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
@@ -190,6 +190,12 @@ public class ASEmitter implements IASEmitter, IEmitter
}
@Override
+ public String postProcess(String output)
+ {
+ return output;
+ }
+
+ @Override
public void write(IEmitterTokens value)
{
write(value.getToken());
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSWriter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
index 9d2c5c1..16a4d4d 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
@@ -77,7 +77,7 @@ public class JSWriter implements IJSWriter
try
{
- out.write(writer.toString().getBytes());
+ out.write(emitter.postProcess(writer.toString()).getBytes());
}
catch (IOException e)
{
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
index 85a9aca..11a6518 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
@@ -88,7 +88,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
@Override
protected String formatQualifiedName(String name)
{
- return ((JSFlexJSEmitter)emitter).formatQualifiedName(name);
+ return ((JSFlexJSEmitter)emitter).formatQualifiedName(name, true);
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index a101a4c..d439da9 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -20,6 +20,7 @@
package org.apache.flex.compiler.internal.codegen.js.flexjs;
import java.io.FilterWriter;
+import java.util.ArrayList;
import java.util.List;
import org.apache.flex.compiler.codegen.js.flexjs.IJSFlexJSEmitter;
@@ -87,6 +88,8 @@ import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
import org.apache.flex.compiler.tree.as.IVariableNode;
import org.apache.flex.compiler.utils.ASNodeUtils;
+import com.google.common.base.Joiner;
+
/**
* Concrete implementation of the 'FlexJS' JavaScript production.
*
@@ -124,6 +127,36 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
private ObjectDefinePropertyEmitter objectDefinePropertyEmitter;
private DefinePropertyFunctionEmitter definePropertyFunctionEmitter;
+ public ArrayList<String> usedNames = new ArrayList<String>();
+
+ @Override
+ public String postProcess(String output)
+ {
+ String[] lines = output.split("\n");
+ ArrayList<String> finalLines = new ArrayList<String>();
+ boolean sawRequires = false;
+ boolean stillSearching = true;
+ for (String line : lines)
+ {
+ if (stillSearching)
+ {
+ int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+ if (c > -1)
+ {
+ int c2 = line.indexOf(")");
+ String s = line.substring(c + 14, c2 - 1);
+ sawRequires = true;
+ if (!usedNames.contains(s))
+ continue;
+ }
+ else if (sawRequires)
+ stillSearching = false;
+ }
+ finalLines.add(line);
+ }
+ return Joiner.on("\n").join(finalLines);
+ }
+
public BindableEmitter getBindableEmitter()
{
return bindableEmitter;
@@ -291,6 +324,11 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
@Override
public String formatQualifiedName(String name)
{
+ return formatQualifiedName(name, false);
+ }
+
+ public String formatQualifiedName(String name, boolean isDoc)
+ {
/*
if (name.contains("goog.") || name.startsWith("Vector."))
return name;
@@ -300,9 +338,14 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
return getModel().getInternalClasses().get(name);
if (name.startsWith("window."))
name = name.substring(7);
+ else if (!isDoc)
+ {
+ if (!usedNames.contains(name))
+ usedNames.add(name);
+ }
return name;
}
-
+
//--------------------------------------------------------------------------
// Package Level
//--------------------------------------------------------------------------
@@ -351,6 +394,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
public void emitPackageHeaderContents(IPackageDefinition definition)
{
packageHeaderEmitter.emitContents(definition);
+ usedNames.clear();
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
index a21cd63..4ed97e7 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
@@ -29,6 +29,7 @@ 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.AccessorDefinition;
import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
+import org.apache.flex.compiler.internal.definitions.TypeDefinitionBase;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
@@ -128,8 +129,10 @@ public class IdentifierEmitter extends JSSubEmitter implements
String qname = nodeDef.getQualifiedName();
if (parentNodeId == ASTNodeID.MemberAccessExpressionID)
write(node.getName());
- else
+ else if (nodeDef instanceof TypeDefinitionBase)
write(getEmitter().formatQualifiedName(qname));
+ else
+ write(qname);
}
else
write(node.getName());
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
index 1110448..daffb46 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
@@ -19,6 +19,8 @@
package org.apache.flex.compiler.internal.codegen.js.jx;
+import java.util.ArrayList;
+
import org.apache.flex.compiler.codegen.ISubEmitter;
import org.apache.flex.compiler.codegen.js.IJSEmitter;
import org.apache.flex.compiler.definitions.IDefinition;
@@ -28,6 +30,7 @@ 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.JSSubEmitter;
import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSDocEmitter;
+import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens;
import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
import org.apache.flex.compiler.scopes.IASScope;
@@ -135,6 +138,5 @@ public class PackageFooterEmitter extends JSSubEmitter implements
write(ASEmitterTokens.SPACE);
write(ASEmitterTokens.BLOCK_CLOSE);
writeNewline(ASEmitterTokens.SEMICOLON);
-
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java
index 56d0fb2..bba7f23 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java
@@ -64,6 +64,12 @@ import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
public class MXMLEmitter extends Emitter implements IMXMLEmitter
{
+ @Override
+ public String postProcess(String output)
+ {
+ return output;
+ }
+
//--------------------------------------------------------------------------
// walkers
//--------------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
index 1d97ea5..81ce78c 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
@@ -67,7 +67,7 @@ public class MXMLWriter extends JSWriter
try
{
- out.write(writer.toString().getBytes());
+ out.write(mxmlEmitter.postProcess(writer.toString()).getBytes());
}
catch (IOException e)
{
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 950f66e..f9f05a4 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -86,6 +86,8 @@ import org.apache.flex.compiler.units.ICompilationUnit;
import org.apache.flex.compiler.utils.NativeUtils;
import org.apache.flex.compiler.visitor.mxml.IMXMLBlockWalker;
+import com.google.common.base.Joiner;
+
/**
* @author Erik de Bruin
*/
@@ -107,6 +109,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
private ArrayList<MXMLScriptSpecifier> scripts;
//private ArrayList<MXMLStyleSpecifier> styles;
private IClassDefinition classDefinition;
+ private ArrayList<String> usedNames = new ArrayList<String>();
private int eventCounter;
private int idCounter;
@@ -137,6 +140,37 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
}
@Override
+ public String postProcess(String output)
+ {
+ IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker()).getASEmitter();
+ usedNames.addAll(((JSFlexJSEmitter)asEmitter).usedNames);
+
+ String[] lines = output.split("\n");
+ ArrayList<String> finalLines = new ArrayList<String>();
+ boolean sawRequires = false;
+ boolean stillSearching = true;
+ for (String line : lines)
+ {
+ if (stillSearching)
+ {
+ int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+ if (c > -1)
+ {
+ int c2 = line.indexOf(")");
+ String s = line.substring(c + 14, c2 - 1);
+ sawRequires = true;
+ if (!usedNames.contains(s))
+ continue;
+ }
+ else if (sawRequires)
+ stillSearching = false;
+ }
+ finalLines.add(line);
+ }
+ return Joiner.on("\n").join(finalLines);
+ }
+
+ @Override
protected String getIndent(int numIndent)
{
final StringBuilder sb = new StringBuilder();
@@ -1972,6 +2006,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
return name;
name = name.replaceAll("\\.", "_");
*/
+ usedNames.add(name);
return name;
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/15b170f8/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 21ec7b6..13108ff 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -147,7 +147,7 @@ public class GoogDepsWriter {
visited.put(current.className, current);
filePathsInOrder.add(current.filePath);
- removeCirculars(current);
+ //removeCirculars(current);
System.out.println("Dependencies calculated for '" + current.filePath + "'");
ArrayList<String> deps = current.deps;
@@ -240,12 +240,14 @@ public class GoogDepsWriter {
// don't add the require if some class needs it at static initialization
// time and that class is not this class
suppressCount++;
+ System.out.println(gd.filePath + " removing circular (static): " + s);
continue;
}
else if (!gd.deps.contains(s))
{
// someone require'd this class
suppressCount++;
+ System.out.println(gd.filePath + " removing circular: " + s);
continue;
}
}
[7/9] git commit: [flex-falcon] [refs/heads/develop] - fix up tests
that need a config for the 'as' path
Posted by ah...@apache.org.
fix up tests that need a config for the 'as' path
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/ec2ac8fd
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/ec2ac8fd
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/ec2ac8fd
Branch: refs/heads/develop
Commit: ec2ac8fd188e0520839eabb05f68a852843b71e0
Parents: a22bc07
Author: Alex Harui <ah...@apache.org>
Authored: Sun Jan 10 07:31:22 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Jan 10 07:31:22 2016 -0800
----------------------------------------------------------------------
.../internal/codegen/js/flexjs/TestFlexJSExpressions.java | 9 +++++++++
.../compiler/internal/codegen/js/flexjs/TestFlexJSFile.java | 9 +++++++++
.../internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java | 9 +++++++++
.../internal/codegen/js/flexjs/TestFlexJSPackage.java | 2 ++
.../codegen/mxml/flexjs/TestFlexJSMXMLApplication.java | 8 ++++++++
5 files changed, 37 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ec2ac8fd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index 9a88c36..8148424 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -23,6 +23,8 @@ import org.apache.flex.compiler.definitions.IClassDefinition;
import org.apache.flex.compiler.driver.IBackend;
import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogExpressions;
import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
import org.apache.flex.compiler.internal.tree.as.ClassNode;
import org.apache.flex.compiler.internal.tree.as.LiteralNode;
import org.apache.flex.compiler.internal.tree.as.NodeBase;
@@ -41,6 +43,13 @@ import org.junit.Test;
*/
public class TestFlexJSExpressions extends TestGoogExpressions
{
+ @Override
+ public void setUp()
+ {
+ project = new FlexJSProject(workspace);
+ ((FlexJSProject)project).config = new JSGoogConfiguration();
+ super.setUp();
+ }
@Ignore
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ec2ac8fd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java
index 660f44b..892bddd 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFile.java
@@ -23,6 +23,8 @@ import java.io.File;
import org.apache.flex.compiler.driver.IBackend;
import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
import org.apache.flex.compiler.internal.test.FlexJSTestBase;
import org.apache.flex.compiler.tree.as.IFileNode;
import org.junit.Test;
@@ -35,6 +37,13 @@ import org.junit.Test;
*/
public class TestFlexJSFile extends FlexJSTestBase
{
+ @Override
+ public void setUp()
+ {
+ super.setUp();
+ ((FlexJSProject)project).config = new JSGoogConfiguration();
+ }
+
@Test
public void testLocalFunction()
{
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ec2ac8fd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
index 35f6823..547a9ed 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
@@ -22,6 +22,8 @@ package org.apache.flex.compiler.internal.codegen.js.flexjs;
import org.apache.flex.compiler.driver.IBackend;
import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogGlobalClasses;
import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
import org.apache.flex.compiler.internal.tree.as.VariableNode;
import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
@@ -37,6 +39,13 @@ import org.junit.Ignore;
*/
public class TestFlexJSGlobalClasses extends TestGoogGlobalClasses
{
+ @Override
+ public void setUp()
+ {
+ project = new FlexJSProject(workspace);
+ ((FlexJSProject)project).config = new JSGoogConfiguration();
+ super.setUp();
+ }
@Override
protected IBackend createBackend()
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ec2ac8fd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
index 2a8aa67..dfb4b75 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
@@ -22,6 +22,7 @@ package org.apache.flex.compiler.internal.codegen.js.flexjs;
import org.apache.flex.compiler.driver.IBackend;
import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogPackage;
import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
import org.apache.flex.compiler.internal.projects.FlexJSProject;
import org.apache.flex.compiler.tree.as.IFileNode;
import org.junit.Test;
@@ -35,6 +36,7 @@ public class TestFlexJSPackage extends TestGoogPackage
public void setUp()
{
project = new FlexJSProject(workspace);
+ ((FlexJSProject)project).config = new JSGoogConfiguration();
super.setUp();
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ec2ac8fd/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
index da0359f..a4dce65 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
@@ -18,12 +18,20 @@
*/
package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
import org.apache.flex.compiler.internal.test.FlexJSTestBase;
import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
import org.junit.Test;
public class TestFlexJSMXMLApplication extends FlexJSTestBase
{
+ @Override
+ public void setUp()
+ {
+ super.setUp();
+ ((FlexJSProject)project).config = new JSGoogConfiguration();
+ }
@Test
public void testFile()
[6/9] git commit: [flex-falcon] [refs/heads/develop] - remove
circulars option
Posted by ah...@apache.org.
remove circulars option
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/a22bc07b
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/a22bc07b
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/a22bc07b
Branch: refs/heads/develop
Commit: a22bc07bb611d9d1e4d4620a38f2cd1429ff6880
Parents: 67ed780
Author: Alex Harui <ah...@apache.org>
Authored: Fri Jan 8 23:54:04 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Jan 8 23:54:04 2016 -0800
----------------------------------------------------------------------
.../org/apache/flex/compiler/internal/graph/GoogDepsWriter.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a22bc07b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 13108ff..4f255c1 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -50,6 +50,7 @@ public class GoogDepsWriter {
{
this.outputFolderPath = outputFolder.getAbsolutePath();
this.mainName = mainClassName;
+ removeCirculars = config.getRemoveCirculars();
otherPaths = config.getSDKJSLib();
otherPaths.add(new File(outputFolder.getParent(), "flexjs/FlexJS/src").getPath());
this.swcs = swcs;
@@ -64,6 +65,7 @@ public class GoogDepsWriter {
private String mainName;
private List<String> otherPaths;
private List<ISWC> swcs;
+ private boolean removeCirculars = false;
private boolean problemsFound = false;
private ArrayList<GoogDep> dps;
@@ -147,7 +149,8 @@ public class GoogDepsWriter {
visited.put(current.className, current);
filePathsInOrder.add(current.filePath);
- //removeCirculars(current);
+ if (removeCirculars)
+ removeCirculars(current);
System.out.println("Dependencies calculated for '" + current.filePath + "'");
ArrayList<String> deps = current.deps;
[4/9] git commit: [flex-falcon] [refs/heads/develop] - fix requires
for internal components
Posted by ah...@apache.org.
fix requires for internal components
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/30524516
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/30524516
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/30524516
Branch: refs/heads/develop
Commit: 30524516b6e4dd13c339286f69f46c83bace2077
Parents: 17d59a9
Author: Alex Harui <ah...@apache.org>
Authored: Fri Jan 8 14:30:08 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Jan 8 14:30:08 2016 -0800
----------------------------------------------------------------------
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/30524516/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index f9f05a4..dd18a90 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -1764,7 +1764,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
public void emitFactory(IMXMLFactoryNode node)
{
MXMLDescriptorSpecifier ps = getCurrentDescriptor("ps");
- ps.value = formatQualifiedName("new org.apache.flex.core.ClassFactory(");
+ ps.value = "new " + formatQualifiedName("org.apache.flex.core.ClassFactory") + "(";
IASNode cnode = node.getChild(0);
if (cnode instanceof IMXMLClassNode)
@@ -1780,9 +1780,9 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
public void emitComponent(IMXMLComponentNode node)
{
MXMLDescriptorSpecifier ps = getCurrentDescriptor("ps");
- ps.value = formatQualifiedName("new org.apache.flex.core.ClassFactory(");
+ ps.value = "new " + formatQualifiedName("org.apache.flex.core.ClassFactory") + "(";
- ps.value += node.getName();
+ ps.value += formatQualifiedName(node.getName());
ps.value += ")";
setBufferWrite(true);
@@ -1881,7 +1881,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
if (NativeUtils.isNative(imp))
continue;
- String formatted = formatQualifiedName(imp);
+ String formatted = formatQualifiedName(imp, false);
if (writtenInstances.indexOf(formatted) == -1)
{
emitHeaderLine(imp);
@@ -1919,7 +1919,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
: JSGoogEmitterTokens.GOOG_REQUIRE);
write(ASEmitterTokens.PAREN_OPEN);
write(ASEmitterTokens.SINGLE_QUOTE);
- write(formatQualifiedName(qname));
+ write(formatQualifiedName(qname, false));
write(ASEmitterTokens.SINGLE_QUOTE);
write(ASEmitterTokens.PAREN_CLOSE);
writeNewline(ASEmitterTokens.SEMICOLON);
@@ -2001,12 +2001,18 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
protected String formatQualifiedName(String name)
{
+ return formatQualifiedName(name, true);
+ }
+
+ protected String formatQualifiedName(String name, boolean useName)
+ {
/*
if (name.contains("goog.") || name.startsWith("Vector."))
return name;
name = name.replaceAll("\\.", "_");
*/
- usedNames.add(name);
+ if (useName && !usedNames.contains(name))
+ usedNames.add(name);
return name;
}
[2/9] git commit: [flex-falcon] [refs/heads/develop] - suppress
warnings when we don't emit a goog.requires for types only mentioned in JSDoc
Posted by ah...@apache.org.
suppress warnings when we don't emit a goog.requires for types only mentioned in JSDoc
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/a61d9064
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/a61d9064
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/a61d9064
Branch: refs/heads/develop
Commit: a61d9064561ad6299bc3a189b0180e1c545496fa
Parents: 15b170f
Author: Alex Harui <ah...@apache.org>
Authored: Thu Jan 7 15:52:32 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Jan 7 15:52:32 2016 -0800
----------------------------------------------------------------------
.../google/javascript/jscomp/FlexJSDiagnosticGroups.java | 9 +++++++++
.../flex/compiler/utils/JSClosureCompilerWrapper.java | 1 +
2 files changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a61d9064/compiler.jx/src/com/google/javascript/jscomp/FlexJSDiagnosticGroups.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/com/google/javascript/jscomp/FlexJSDiagnosticGroups.java b/compiler.jx/src/com/google/javascript/jscomp/FlexJSDiagnosticGroups.java
index e28cfe7..5b77b44 100644
--- a/compiler.jx/src/com/google/javascript/jscomp/FlexJSDiagnosticGroups.java
+++ b/compiler.jx/src/com/google/javascript/jscomp/FlexJSDiagnosticGroups.java
@@ -46,4 +46,13 @@ public class FlexJSDiagnosticGroups {
DiagnosticGroups.registerGroup("flexjsReferenceBeforeDeclare",
VariableReferenceCheck.UNDECLARED_REFERENCE);
*/
+
+ /**
+ * Flex code won't always generate a goog.requires for types only used
+ * in JSDoc annotations, but the compiler complains.
+ */
+ public static final DiagnosticGroup FLEXJS_UNKNOWN_JSDOC_TYPE_NAME =
+ DiagnosticGroups.registerGroup("flexjsUnknownJSDocTypeName",
+ RhinoErrorReporter.TYPE_PARSE_ERROR);
+
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/a61d9064/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java b/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
index a9aa8bd..05e0328 100644
--- a/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
+++ b/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
@@ -277,6 +277,7 @@ public class JSClosureCompilerWrapper
// still want warnings for others in the group.
options_.setWarningLevel(FlexJSDiagnosticGroups.FLEXJS_NOT_A_CONSTRUCTOR, CheckLevel.OFF);
options_.setWarningLevel(FlexJSDiagnosticGroups.FLEXJS_SUPER_CALL_TO_DIFFERENT_NAME, CheckLevel.OFF);
+ options_.setWarningLevel(FlexJSDiagnosticGroups.FLEXJS_UNKNOWN_JSDOC_TYPE_NAME, CheckLevel.OFF);
// options_.setWarningLevel(FlexJSDiagnosticGroups.FLEXJS_REFERENCE_BEFORE_DECLARE, CheckLevel.OFF);
}
[8/9] git commit: [flex-falcon] [refs/heads/develop] - fix ignore
Posted by ah...@apache.org.
fix ignore
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/21f4051f
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/21f4051f
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/21f4051f
Branch: refs/heads/develop
Commit: 21f4051fd44fee37cc8657cc1111b2d6596005b1
Parents: ec2ac8f
Author: Alex Harui <ah...@apache.org>
Authored: Mon Jan 11 08:07:39 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Jan 11 08:07:39 2016 -0800
----------------------------------------------------------------------
.../apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/21f4051f/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
index b18cb88..9f242ba 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
@@ -103,7 +103,7 @@ public class AsIsEmitter extends JSSubEmitter
int ignoreIndex = asDocString.indexOf(ignoreToken);
while (ignoreIndex != -1)
{
- String ignorable = asDocString.substring(emitIndex
+ String ignorable = asDocString.substring(ignoreIndex
+ ignoreToken.length());
int endIndex = ignorable.indexOf("\n");
ignorable = ignorable.substring(0, endIndex);
[5/9] git commit: [flex-falcon] [refs/heads/develop] - compiler
options to optimize output by removing certain kinds of coercions
Posted by ah...@apache.org.
compiler options to optimize output by removing certain kinds of coercions
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/67ed780e
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/67ed780e
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/67ed780e
Branch: refs/heads/develop
Commit: 67ed780ef705fe654f0f616b1be0a0ea4c0604c5
Parents: 3052451
Author: Alex Harui <ah...@apache.org>
Authored: Fri Jan 8 23:24:42 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Jan 8 23:24:42 2016 -0800
----------------------------------------------------------------------
.../apache/flex/compiler/clients/MXMLJSC.java | 1 +
.../codegen/js/flexjs/JSFlexJSDocEmitter.java | 27 ++++++++++
.../js/flexjs/JSFlexJSEmitterTokens.java | 3 ++
.../internal/codegen/js/jx/AsIsEmitter.java | 54 ++++++++++++++------
.../driver/js/goog/JSGoogConfiguration.java | 40 +++++++++++++++
.../internal/projects/FlexJSProject.java | 4 ++
6 files changed, 113 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/67ed780e/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java b/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
index 750c54a..35a9609 100644
--- a/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
+++ b/compiler.jx/src/org/apache/flex/compiler/clients/MXMLJSC.java
@@ -703,6 +703,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
problems = new ProblemQuery(
projectConfigurator.getCompilerProblemSettings());
+ project.config = (JSGoogConfiguration)projectConfigurator.getConfiguration();
config = projectConfigurator.getConfiguration();
configBuffer = projectConfigurator.getConfigurationBuffer();
problems.addAll(projectConfigurator.getConfigurationProblems());
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/67ed780e/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
index 5dc097b..057bcf1 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
@@ -48,6 +48,7 @@ import org.apache.flex.compiler.tree.as.IVariableNode;
public class JSFlexJSDocEmitter extends JSGoogDocEmitter
{
private List<String> classIgnoreList;
+ private List<String> ignoreList;
private List<String> coercionList;
public JSFlexJSDocEmitter(IJSEmitter emitter)
@@ -68,6 +69,11 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
@Override
protected String convertASTypeToJS(String name, String pname)
{
+ if (ignoreList != null)
+ {
+ if (ignoreList.contains(pname + "." + name))
+ return IASLanguageConstants.Object;
+ }
if (coercionList != null)
{
if (!coercionList.contains(pname + "." + name))
@@ -95,6 +101,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
public void emitMethodDoc(IFunctionNode node, ICompilerProject project)
{
coercionList = null;
+ ignoreList = null;
IClassDefinition classDefinition = resolveClassDefinition(node);
@@ -156,6 +163,10 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
.getToken();
if (docText.contains(keepToken))
loadKeepers(docText);
+ String ignoreToken = JSFlexJSEmitterTokens.IGNORE_COERCION
+ .getToken();
+ if (docText.contains(ignoreToken))
+ loadIgnores(docText);
write(changeAnnotations(asDoc.commentNoEnd()));
}
else
@@ -242,6 +253,22 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
}
}
+ private void loadIgnores(String doc)
+ {
+ ignoreList = new ArrayList<String>();
+ String ignoreToken = JSFlexJSEmitterTokens.IGNORE_COERCION.getToken();
+ int index = doc.indexOf(ignoreToken);
+ while (index != -1)
+ {
+ String ignore = doc.substring(index + ignoreToken.length());
+ int endIndex = ignore.indexOf("\n");
+ ignore = ignore.substring(0, endIndex);
+ ignore = ignore.trim();
+ ignoreList.add(ignore);
+ index = doc.indexOf(ignoreToken, index + endIndex);
+ }
+ }
+
private void loadKeepers(String doc)
{
coercionList = new ArrayList<String>();
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/67ed780e/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
index a09c9ab..4c4a16b 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
@@ -35,6 +35,7 @@ public enum JSFlexJSEmitterTokens implements IEmitterTokens
QNAME("qName"),
UNDERSCORE("_"),
EMIT_COERCION("@flexjsemitcoercion"),
+ IGNORE_COERCION("@flexjsignorecoercion"),
IGNORE_IMPORT("@flexjsignoreimport"),
PREINCREMENT("preincrement"),
PREDECREMENT("predecrement"),
@@ -43,6 +44,8 @@ public enum JSFlexJSEmitterTokens implements IEmitterTokens
SUPERGETTER("superGetter"),
SUPERSETTER("superSetter"),
CLOSURE_FUNCTION_NAME("org.apache.flex.utils.Language.closure"),
+ SKIP_AS_COERCIONS("skipAsCoercions"),
+ SKIP_FUNCTION_COERCIONS("skipFunctionCoercions"),
;
private String token;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/67ed780e/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
index b821d7a..b18cb88 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
@@ -50,12 +50,30 @@ public class AsIsEmitter extends JSSubEmitter
.resolve(getProject()) : null;
if (id != ASTNodeID.Op_IsID && dnode != null)
{
- boolean emit = false;
+ boolean emit = coercion ?
+ !((FlexJSProject)getProject()).config.getJSOutputOptimizations().contains(JSFlexJSEmitterTokens.SKIP_FUNCTION_COERCIONS.getToken()) :
+ !((FlexJSProject)getProject()).config.getJSOutputOptimizations().contains(JSFlexJSEmitterTokens.SKIP_AS_COERCIONS.getToken());
+
// find the function node
IFunctionNode functionNode = (IFunctionNode) left
.getAncestorOfType(IFunctionNode.class);
if (functionNode != null) // can be null in synthesized binding code
{
+ if (coercion)
+ {
+ // see if the cast is inside a try/catch in this function. If so,
+ // assume that we want an exception.
+ IASNode child = left.getParent();
+ while (child != functionNode)
+ {
+ if (child.getNodeID() == ASTNodeID.TryID)
+ {
+ emit = true;
+ break;
+ }
+ child = child.getParent();
+ }
+ }
ASDocComment asDoc = (ASDocComment) functionNode
.getASDocComment();
if (asDoc != null)
@@ -80,21 +98,25 @@ public class AsIsEmitter extends JSSubEmitter
emitIndex = asDocString.indexOf(coercionToken,
emitIndex + coercionToken.length());
}
- }
- if (coercion)
- {
- // see if the cast is inside a try/catch in this function. If so,
- // assume that we want an exception.
- IASNode child = left.getParent();
- while (child != functionNode)
- {
- if (child.getNodeID() == ASTNodeID.TryID)
- {
- emit = true;
- break;
- }
- child = child.getParent();
- }
+ String ignoreToken = JSFlexJSEmitterTokens.IGNORE_COERCION
+ .getToken();
+ int ignoreIndex = asDocString.indexOf(ignoreToken);
+ while (ignoreIndex != -1)
+ {
+ String ignorable = asDocString.substring(emitIndex
+ + ignoreToken.length());
+ int endIndex = ignorable.indexOf("\n");
+ ignorable = ignorable.substring(0, endIndex);
+ ignorable = ignorable.trim();
+ String rightSide = dnode.getQualifiedName();
+ if (ignorable.equals(rightSide))
+ {
+ emit = false;
+ break;
+ }
+ ignoreIndex = asDocString.indexOf(ignoreToken,
+ ignoreIndex + ignoreToken.length());
+ }
}
}
if (!emit)
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/67ed780e/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
index 55f449e..0f03323 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
@@ -236,6 +236,27 @@ public class JSGoogConfiguration extends JSConfiguration
+ //
+ // 'remove-circulars'
+ //
+
+ private boolean removeCirculars = false;
+
+ public boolean getRemoveCirculars()
+ {
+ return removeCirculars;
+ }
+
+ @Config
+ @Mapping("remove-circulars")
+ public void setRemoveCirculars(ConfigurationValue cv, boolean value)
+ throws ConfigurationException
+ {
+ removeCirculars = value;
+ }
+
+
+
protected String getAbsolutePathFromPathRelativeToMXMLC(String relativePath)
throws IOException
{
@@ -268,4 +289,23 @@ public class JSGoogConfiguration extends JSConfiguration
jsCompilerOptions.addAll(value);
}
+ //
+ // 'js-output-optimization'
+ //
+
+ protected List<String> jsOutputOptimizations = new ArrayList<String>();
+
+ public List<String> getJSOutputOptimizations()
+ {
+ return jsOutputOptimizations;
+ }
+
+ @Config(allowMultiple = true)
+ @Mapping("js-output-optimization")
+ @InfiniteArguments
+ public void setJSOutputOptimizations(ConfigurationValue cv, List<String> value)
+ throws ConfigurationException
+ {
+ jsOutputOptimizations.addAll(value);
+ }
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/67ed780e/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
index 6ce6e23..1cf6d3d 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
@@ -25,12 +25,14 @@ import java.util.List;
import java.util.Set;
import org.apache.flex.compiler.common.DependencyType;
+import org.apache.flex.compiler.config.Configuration;
import org.apache.flex.compiler.definitions.IDefinition;
import org.apache.flex.compiler.definitions.IScopedDefinition;
import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitterTokens;
import org.apache.flex.compiler.internal.css.codegen.CSSCompilationSession;
import org.apache.flex.compiler.internal.definitions.InterfaceDefinition;
import org.apache.flex.compiler.internal.driver.js.flexjs.JSCSSCompilationSession;
+import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
import org.apache.flex.compiler.internal.scopes.ASProjectScope.DefinitionPromise;
import org.apache.flex.compiler.internal.scopes.ASScope;
import org.apache.flex.compiler.internal.scopes.PackageScope;
@@ -63,6 +65,8 @@ public class FlexJSProject extends FlexProject
private HashMap<ICompilationUnit, HashMap<String, String>> interfaces = new HashMap<ICompilationUnit, HashMap<String, String>>();
private HashMap<ICompilationUnit, HashMap<String, DependencyType>> requires = new HashMap<ICompilationUnit, HashMap<String, DependencyType>>();
+ public JSGoogConfiguration config;
+
public ICompilationUnit mainCU;
@Override
[3/9] git commit: [flex-falcon] [refs/heads/develop] - flip default
to not emit coercions, even for function casting
Posted by ah...@apache.org.
flip default to not emit coercions, even for function casting
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/17d59a94
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/17d59a94
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/17d59a94
Branch: refs/heads/develop
Commit: 17d59a948adb75b39a4146f17cd7fcab9f3a7b4b
Parents: a61d906
Author: Alex Harui <ah...@apache.org>
Authored: Fri Jan 8 14:29:41 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Jan 8 14:29:41 2016 -0800
----------------------------------------------------------------------
.../codegen/js/flexjs/JSFlexJSDocEmitter.java | 34 ++++++-------
.../js/flexjs/JSFlexJSEmitterTokens.java | 2 +-
.../internal/codegen/js/jx/AsIsEmitter.java | 52 +++++++++++++-------
3 files changed, 52 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/17d59a94/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
index 11a6518..5dc097b 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
@@ -48,7 +48,7 @@ import org.apache.flex.compiler.tree.as.IVariableNode;
public class JSFlexJSDocEmitter extends JSGoogDocEmitter
{
private List<String> classIgnoreList;
- private List<String> ignoreList;
+ private List<String> coercionList;
public JSFlexJSDocEmitter(IJSEmitter emitter)
{
@@ -68,9 +68,9 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
@Override
protected String convertASTypeToJS(String name, String pname)
{
- if (ignoreList != null)
+ if (coercionList != null)
{
- if (ignoreList.contains(pname + "." + name))
+ if (!coercionList.contains(pname + "." + name))
return IASLanguageConstants.Object;
}
if (classIgnoreList != null)
@@ -94,7 +94,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
@Override
public void emitMethodDoc(IFunctionNode node, ICompilerProject project)
{
- ignoreList = null;
+ coercionList = null;
IClassDefinition classDefinition = resolveClassDefinition(node);
@@ -152,10 +152,10 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
if (asDoc != null && MXMLJSC.keepASDoc)
{
String docText = asDoc.commentNoEnd();
- String ignoreToken = JSFlexJSEmitterTokens.IGNORE_COERCION
+ String keepToken = JSFlexJSEmitterTokens.EMIT_COERCION
.getToken();
- if (docText.contains(ignoreToken))
- loadIgnores(docText);
+ if (docText.contains(keepToken))
+ loadKeepers(docText);
write(changeAnnotations(asDoc.commentNoEnd()));
}
else
@@ -242,19 +242,19 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
}
}
- private void loadIgnores(String doc)
+ private void loadKeepers(String doc)
{
- ignoreList = new ArrayList<String>();
- String ignoreToken = JSFlexJSEmitterTokens.IGNORE_COERCION.getToken();
- int index = doc.indexOf(ignoreToken);
+ coercionList = new ArrayList<String>();
+ String keepToken = JSFlexJSEmitterTokens.EMIT_COERCION.getToken();
+ int index = doc.indexOf(keepToken);
while (index != -1)
{
- String ignorable = doc.substring(index + ignoreToken.length());
- int endIndex = ignorable.indexOf("\n");
- ignorable = ignorable.substring(0, endIndex);
- ignorable = ignorable.trim();
- ignoreList.add(ignorable);
- index = doc.indexOf(ignoreToken, index + endIndex);
+ String keeper = doc.substring(index + keepToken.length());
+ int endIndex = keeper.indexOf("\n");
+ keeper = keeper.substring(0, endIndex);
+ keeper = keeper.trim();
+ coercionList.add(keeper);
+ index = doc.indexOf(keepToken, index + endIndex);
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/17d59a94/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
index e9db7db..a09c9ab 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
@@ -34,7 +34,7 @@ public enum JSFlexJSEmitterTokens implements IEmitterTokens
NAMES("names"),
QNAME("qName"),
UNDERSCORE("_"),
- IGNORE_COERCION("@flexjsignorecoercion"),
+ EMIT_COERCION("@flexjsemitcoercion"),
IGNORE_IMPORT("@flexjsignoreimport"),
PREINCREMENT("preincrement"),
PREDECREMENT("predecrement"),
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/17d59a94/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
index 540f558..b821d7a 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
@@ -29,6 +29,7 @@ import org.apache.flex.compiler.internal.definitions.ClassDefinition;
import org.apache.flex.compiler.internal.projects.FlexJSProject;
import org.apache.flex.compiler.projects.ICompilerProject;
import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.tree.as.IExpressionNode;
import org.apache.flex.compiler.tree.as.IFunctionNode;
@@ -49,6 +50,7 @@ public class AsIsEmitter extends JSSubEmitter
.resolve(getProject()) : null;
if (id != ASTNodeID.Op_IsID && dnode != null)
{
+ boolean emit = false;
// find the function node
IFunctionNode functionNode = (IFunctionNode) left
.getAncestorOfType(IFunctionNode.class);
@@ -59,32 +61,46 @@ public class AsIsEmitter extends JSSubEmitter
if (asDoc != null)
{
String asDocString = asDoc.commentNoEnd();
- String ignoreToken = JSFlexJSEmitterTokens.IGNORE_COERCION
+ String coercionToken = JSFlexJSEmitterTokens.EMIT_COERCION
.getToken();
- boolean ignore = false;
- int ignoreIndex = asDocString.indexOf(ignoreToken);
- while (ignoreIndex != -1)
+ int emitIndex = asDocString.indexOf(coercionToken);
+ while (emitIndex != -1)
{
- String ignorable = asDocString.substring(ignoreIndex
- + ignoreToken.length());
- int endIndex = ignorable.indexOf("\n");
- ignorable = ignorable.substring(0, endIndex);
- ignorable = ignorable.trim();
+ String emitable = asDocString.substring(emitIndex
+ + coercionToken.length());
+ int endIndex = emitable.indexOf("\n");
+ emitable = emitable.substring(0, endIndex);
+ emitable = emitable.trim();
String rightSide = dnode.getQualifiedName();
- if (ignorable.equals(rightSide))
+ if (emitable.equals(rightSide))
{
- ignore = true;
+ emit = true;
break;
}
- ignoreIndex = asDocString.indexOf(ignoreToken,
- ignoreIndex + ignoreToken.length());
- }
- if (ignore)
- {
- getWalker().walk(left);
- return;
+ emitIndex = asDocString.indexOf(coercionToken,
+ emitIndex + coercionToken.length());
}
}
+ if (coercion)
+ {
+ // see if the cast is inside a try/catch in this function. If so,
+ // assume that we want an exception.
+ IASNode child = left.getParent();
+ while (child != functionNode)
+ {
+ if (child.getNodeID() == ASTNodeID.TryID)
+ {
+ emit = true;
+ break;
+ }
+ child = child.getParent();
+ }
+ }
+ }
+ if (!emit)
+ {
+ getWalker().walk(left);
+ return;
}
}
[9/9] git commit: [flex-falcon] [refs/heads/develop] - Merge branch
'deps' into develop
Posted by ah...@apache.org.
Merge branch 'deps' into develop
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f3f082fa
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f3f082fa
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f3f082fa
Branch: refs/heads/develop
Commit: f3f082fa3aff3ddccd972d1b3e47729764fbb9bd
Parents: 0c69c38 21f4051
Author: Alex Harui <ah...@apache.org>
Authored: Mon Jan 11 08:41:23 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Jan 11 08:41:23 2016 -0800
----------------------------------------------------------------------
.../js/flexjs/TestFlexJSExpressions.java | 9 +++
.../codegen/js/flexjs/TestFlexJSFile.java | 9 +++
.../js/flexjs/TestFlexJSGlobalClasses.java | 9 +++
.../codegen/js/flexjs/TestFlexJSPackage.java | 2 +
.../mxml/flexjs/TestFlexJSMXMLApplication.java | 8 +++
.../jscomp/FlexJSDiagnosticGroups.java | 9 +++
.../apache/flex/compiler/clients/MXMLJSC.java | 1 +
.../flex/compiler/codegen/as/IASEmitter.java | 2 +
.../compiler/codegen/mxml/IMXMLEmitter.java | 2 +
.../compiler/internal/codegen/as/ASEmitter.java | 6 ++
.../compiler/internal/codegen/js/JSWriter.java | 2 +-
.../codegen/js/flexjs/JSFlexJSDocEmitter.java | 47 ++++++++++---
.../codegen/js/flexjs/JSFlexJSEmitter.java | 46 +++++++++++-
.../js/flexjs/JSFlexJSEmitterTokens.java | 3 +
.../internal/codegen/js/jx/AsIsEmitter.java | 74 +++++++++++++++-----
.../codegen/js/jx/IdentifierEmitter.java | 5 +-
.../codegen/js/jx/PackageFooterEmitter.java | 4 +-
.../internal/codegen/mxml/MXMLEmitter.java | 6 ++
.../internal/codegen/mxml/MXMLWriter.java | 2 +-
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 51 ++++++++++++--
.../driver/js/goog/JSGoogConfiguration.java | 40 +++++++++++
.../compiler/internal/graph/GoogDepsWriter.java | 7 +-
.../internal/projects/FlexJSProject.java | 4 ++
.../utils/JSClosureCompilerWrapper.java | 1 +
24 files changed, 310 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f3f082fa/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
----------------------------------------------------------------------