flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [2/2] git commit: [flex-falcon] [refs/heads/develop] - don't always emit require for Language
Date Sat, 13 Jun 2015 21:47:06 GMT
don't always emit require for Language


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/b3bf4b54
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/b3bf4b54
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/b3bf4b54

Branch: refs/heads/develop
Commit: b3bf4b54445f64303ac114261dbb867abad30fde
Parents: ccde03c
Author: Alex Harui <aharui@apache.org>
Authored: Sat Jun 13 14:46:10 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Sat Jun 13 14:46:53 2015 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/jx/AsIsEmitter.java     |  6 ++++++
 .../codegen/js/jx/BinaryOperatorEmitter.java    |  6 ++++++
 .../codegen/js/jx/FunctionCallEmitter.java      |  5 +++++
 .../codegen/js/jx/MemberAccessEmitter.java      |  5 +++++
 .../codegen/js/jx/PackageHeaderEmitter.java     | 22 +++++++++++++-------
 .../codegen/js/jx/SuperCallEmitter.java         |  5 +++++
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  |  6 +++++-
 .../internal/projects/FlexJSProject.java        |  2 ++
 8 files changed, 49 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3bf4b54/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 ac45b88..3ee2fb8 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
@@ -25,6 +25,8 @@ import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
 import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens;
+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.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
@@ -85,6 +87,10 @@ public class AsIsEmitter extends JSSubEmitter
             }
         }
 
+        ICompilerProject project = this.getProject();
+        if (project instanceof FlexJSProject)
+        	((FlexJSProject)project).needLanguage = true;
+        
         write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
         write(ASEmitterTokens.MEMBER_ACCESS);
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3bf4b54/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index e3d151c..7509907 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -27,6 +27,8 @@ import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
 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.definitions.AccessorDefinition;
+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.IBinaryOperatorNode;
@@ -97,6 +99,10 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
                                     .startsWith("!"));
                     if (isAssignment)
                     {
+                        ICompilerProject project = this.getProject();
+                        if (project instanceof FlexJSProject)
+                        	((FlexJSProject)project).needLanguage = true;
+                        
                         write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
                         write(ASEmitterTokens.MEMBER_ACCESS);
                         write(JSFlexJSEmitterTokens.SUPERSETTER);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3bf4b54/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
index 788cd75..7e34b62 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
@@ -30,6 +30,8 @@ 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.definitions.ClassDefinition;
 import org.apache.flex.compiler.internal.definitions.InterfaceDefinition;
+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.IFunctionCallNode;
@@ -100,6 +102,9 @@ public class FunctionCallEmitter extends JSSubEmitter implements
                             || def.getBaseName().equals(
                                     IASGlobalFunctionConstants.uint))
                     {
+                        ICompilerProject project = this.getProject();
+                        if (project instanceof FlexJSProject)
+                        	((FlexJSProject)project).needLanguage = true;
                         write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
                         write(ASEmitterTokens.MEMBER_ACCESS);
                         if (isInt)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3bf4b54/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
index 9bce1ae..311c126 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
@@ -26,8 +26,10 @@ import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
 import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens;
 import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.tree.as.GetterNode;
 import org.apache.flex.compiler.internal.tree.as.UnaryOperatorAtNode;
+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.IClassNode;
@@ -106,6 +108,9 @@ public class MemberAccessEmitter extends JSSubEmitter implements
                 else if (leftNode.getNodeID() == ASTNodeID.SuperID
                         && (rightNode.getNodeID() == ASTNodeID.GetterID || (rightDef
!= null && rightDef instanceof AccessorDefinition)))
                 {
+                    ICompilerProject project = this.getProject();
+                    if (project instanceof FlexJSProject)
+                    	((FlexJSProject)project).needLanguage = true;
                     // setter is handled in binaryOperator
                     write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
                     write(ASEmitterTokens.MEMBER_ACCESS);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3bf4b54/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
index da13f75..f5fe623 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
@@ -36,6 +36,7 @@ import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.scopes.ASProjectScope;
 import org.apache.flex.compiler.internal.scopes.PackageScope;
 import org.apache.flex.compiler.internal.tree.as.ClassNode;
+import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.scopes.IASScope;
 import org.apache.flex.compiler.tree.as.ITypeNode;
 import org.apache.flex.compiler.units.ICompilationUnit;
@@ -197,13 +198,20 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
                 && cu.getName().equals(flexProject.mainCU.getName());
         if (isMainCU)
         {
-            write(JSGoogEmitterTokens.GOOG_REQUIRE);
-            write(ASEmitterTokens.PAREN_OPEN);
-            write(ASEmitterTokens.SINGLE_QUOTE);
-            write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
-            write(ASEmitterTokens.SINGLE_QUOTE);
-            write(ASEmitterTokens.PAREN_CLOSE);
-            writeNewline(ASEmitterTokens.SEMICOLON);
+            ICompilerProject project = this.getProject();
+            if (project instanceof FlexJSProject)
+            {
+            	if (((FlexJSProject)project).needLanguage)
+            	{
+		            write(JSGoogEmitterTokens.GOOG_REQUIRE);
+		            write(ASEmitterTokens.PAREN_OPEN);
+		            write(ASEmitterTokens.SINGLE_QUOTE);
+		            write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
+		            write(ASEmitterTokens.SINGLE_QUOTE);
+		            write(ASEmitterTokens.PAREN_CLOSE);
+		            writeNewline(ASEmitterTokens.SEMICOLON);
+            	}
+            }
         }
 
         if (emitsRequires || emitsInterfaces || isMainCU)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3bf4b54/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/SuperCallEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/SuperCallEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/SuperCallEmitter.java
index 8e48678..b6788bd 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/SuperCallEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/SuperCallEmitter.java
@@ -31,8 +31,10 @@ import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
 import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.tree.as.BinaryOperatorAssignmentNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
+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.IClassNode;
@@ -77,6 +79,9 @@ public class SuperCallEmitter extends JSSubEmitter
                     && (fnode.getNodeID() == ASTNodeID.GetterID || fnode
                             .getNodeID() == ASTNodeID.SetterID))
             {
+                ICompilerProject project = this.getProject();
+                if (project instanceof FlexJSProject)
+                	((FlexJSProject)project).needLanguage = true;
                 write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
                 write(ASEmitterTokens.MEMBER_ACCESS);
                 if (fnode.getNodeID() == ASTNodeID.GetterID)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3bf4b54/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 41fd718..0f4e81f 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
@@ -1839,7 +1839,11 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         if (project.mainCU != null &&
                 cu.getName().equals(project.mainCU.getName()))
         {
-            emitHeaderLine(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
+            if (project instanceof FlexJSProject)
+            {
+            	if (((FlexJSProject)project).needLanguage)
+            		emitHeaderLine(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
+            }
         }
 
         writeNewline();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b3bf4b54/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 4bc69a3..b150264 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
@@ -125,6 +125,8 @@ public class FlexJSProject extends FlexProject
         super.addDependency(from, to, dt, qname);
     }
 
+    public boolean needLanguage;
+    
     private LinkageChecker linkageChecker;
     private ITargetSettings ts;
 


Mime
View raw message