flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [03/50] git commit: [flex-falcon] [refs/heads/master] - add provides for internal classes so the GoogDepsWriter will search for all dependencies in a file
Date Mon, 26 Jun 2017 15:44:43 GMT
add provides for internal classes so the GoogDepsWriter will search for all dependencies in
a file


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

Branch: refs/heads/master
Commit: 3f9ed83de08907a52392044be78ad324287c6662
Parents: e11cf7e
Author: Alex Harui <aharui@apache.org>
Authored: Sun Apr 23 22:43:30 2017 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Sun Apr 23 22:43:30 2017 -0700

----------------------------------------------------------------------
 .../codegen/js/jx/PackageHeaderEmitter.java       | 18 ++++++++++++++++++
 .../compiler/internal/graph/GoogDepsWriter.java   | 15 ++++++++++++++-
 .../codegen/js/flexjs/TestFlexJSPackage.java      |  8 ++++++++
 .../flexjs/projects/internal/MainClass_result.js  |  1 +
 4 files changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3f9ed83d/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
index 73d3b80..5c9c91c 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
@@ -23,6 +23,7 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 
 import org.apache.flex.compiler.asdoc.flexjs.ASDocComment;
@@ -149,7 +150,24 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
         write(ASEmitterTokens.SINGLE_QUOTE);
         write(ASEmitterTokens.PAREN_CLOSE);
         writeNewline(ASEmitterTokens.SEMICOLON);
+        
+        HashMap<String, String> internalClasses = getEmitter().getModel().getInternalClasses();
+        if (internalClasses.size() > 0)
+        {
+        	for (String internalClass : internalClasses.keySet())
+        	{
+        	       /* goog.provide('x');\n\n */
+                write(JSGoogEmitterTokens.GOOG_PROVIDE);
+                write(ASEmitterTokens.PAREN_OPEN);
+                write(ASEmitterTokens.SINGLE_QUOTE);
+                write(((JSFlexJSEmitter)getEmitter()).formatQualifiedName(internalClass,
true));
+                write(ASEmitterTokens.SINGLE_QUOTE);
+                write(ASEmitterTokens.PAREN_CLOSE);
+                writeNewline(ASEmitterTokens.SEMICOLON);
+        	}
+        }
         writeNewline();
+
     }
 
     public void emitContents(IPackageDefinition definition)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3f9ed83d/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 5c122d4..49038cd 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -379,6 +379,8 @@ public class GoogDepsWriter {
 		{
 	        for (String dep : gd.fileInfo.impls)
 	        {
+	        	if (gd.fileInfo.provides != null &&
+	        			gd.fileInfo.provides.contains(dep)) continue;
 	            addDeps(dep);
 	        }
 		}
@@ -388,6 +390,8 @@ public class GoogDepsWriter {
 	        for (String dep : gd.fileInfo.deps)
 	        {
 	        	gd.deps.add(dep);
+	        	if (gd.fileInfo.provides != null &&
+	        			gd.fileInfo.provides.contains(dep)) continue;
 	            addDeps(dep);
 	        }
 		}
@@ -590,8 +594,16 @@ public class GoogDepsWriter {
 					        	c = line.indexOf("goog.provide");
 					        	if (c > -1)
 					        	{
-					        		if (fi.googProvideLine == -i)
+					        		if (fi.googProvideLine == -1)
 					        			fi.googProvideLine = i;
+					        		if (numProvides > 0)
+					        		{
+					        			if (fi.provides == null)
+					        				fi.provides = new ArrayList<String>();
+					        			c2 = line.indexOf(")", c);
+					        			String provide = line.substring(c + 14, c2 - 1);
+					        			fi.provides.add(provide);
+					        		}
 					        		numProvides++;
 					        	}
 					        	else
@@ -865,6 +877,7 @@ public class GoogDepsWriter {
 		public ArrayList<String> impls;
 		public ArrayList<String> deps;
 		public ArrayList<String> staticDeps;
+		public ArrayList<String> provides;
 		public int constructorLine;
 		public int depsLine;
 		public int suppressLine;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3f9ed83d/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
index 9e94828..01932d0 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
@@ -434,6 +434,7 @@ public class TestFlexJSPackage extends TestGoogPackage
         		  " */\n" +
         		  "\n" +
         		  "goog.provide('foo.bar.baz.A');\n" +
+        		  "goog.provide('foo.bar.baz.A.InternalClass');\n" +
         		  "\n" +
         		  "\n" +
         		  "\n" +
@@ -538,6 +539,7 @@ public class TestFlexJSPackage extends TestGoogPackage
 				" */\n" +
 				"\n" +
 				"goog.provide('foo.bar.baz.A');\n" +
+				"goog.provide('foo.bar.baz.A.internalFunction');\n" +
 				"\n" +
 				"\n" +
 				"\n" +
@@ -606,6 +608,7 @@ public class TestFlexJSPackage extends TestGoogPackage
 				" */\n" +
 				"\n" +
 				"goog.provide('foo.bar.baz.A');\n" +
+				"goog.provide('foo.bar.baz.A.internalVar');\n" +
 				"\n" +
 				"\n" +
 				"\n" +
@@ -686,6 +689,7 @@ public class TestFlexJSPackage extends TestGoogPackage
         		  " */\n" +
         		  "\n" +
         		  "goog.provide('foo.bar.baz.A');\n" +
+        		  "goog.provide('foo.bar.baz.A.InternalClass');\n" +
         		  "\n" +
         		  "\n" +
         		  "\n" +
@@ -838,6 +842,7 @@ public class TestFlexJSPackage extends TestGoogPackage
         		  " */\n" +
         		  "\n" +
         		  "goog.provide('foo.bar.baz.A');\n" +
+        		  "goog.provide('foo.bar.baz.A.InternalClass');\n" +
         		  "\n" +
         		  "\n" +
         		  "\n" +
@@ -995,6 +1000,8 @@ public class TestFlexJSPackage extends TestGoogPackage
         		  " */\n" +
         		  "\n" +
         		  "goog.provide('foo.bar.baz.A');\n" +
+        		  "goog.provide('foo.bar.baz.A.InternalClass');\n" +
+        		  "goog.provide('foo.bar.baz.A.ITestInterface');\n" +
         		  "\n" +
         		  "\n" +
         		  "\n" +
@@ -1153,6 +1160,7 @@ public class TestFlexJSPackage extends TestGoogPackage
 				" */\n" +
 				"\n" +
 				"goog.provide('foo.bar.A');\n" +
+				"goog.provide('foo.bar.A.Internal');\n" +
 				"\n" +
 				"\n" +
 				"\n" +

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3f9ed83d/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js b/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
index a96b203..c1f9dd7 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/internal/MainClass_result.js
@@ -20,6 +20,7 @@
  */
 
 goog.provide('MainClass');
+goog.provide('MainClass.InternalClass');
 
 goog.require('OtherClass');
 


Mime
View raw message