flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject git commit: [flex-falcon] [refs/heads/develop] - option to skip @export statements in most JS output
Date Tue, 08 Aug 2017 20:53:50 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 42516a88d -> d69cf6c7f


option to skip @export statements in most JS output


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

Branch: refs/heads/develop
Commit: d69cf6c7fd18bdc2332cea8a8f84f1ff47199272
Parents: 42516a8
Author: Alex Harui <aharui@apache.org>
Authored: Tue Aug 8 13:53:42 2017 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Tue Aug 8 13:53:42 2017 -0700

----------------------------------------------------------------------
 .../codegen/js/flexjs/JSFlexJSDocEmitter.java   | 12 +++++++++++
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 16 +++++++++++----
 .../js/goog/JSGoogCompcConfiguration.java       | 20 +++++++++++++++++++
 .../driver/js/goog/JSGoogConfiguration.java     | 21 ++++++++++++++++++++
 4 files changed, 65 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d69cf6c7/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
index 0cb1309..6077953 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
@@ -37,10 +37,12 @@ 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.JSSessionModel;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogDocEmitter;
+import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogDocEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.jx.BindableEmitter;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.scopes.ASScope;
 import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
@@ -53,6 +55,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
     private List<String> ignoreList;
     private List<String> coercionList;
     public boolean emitStringConversions = true;
+    private boolean emitExports = true;
 
     public JSFlexJSDocEmitter(IJSEmitter emitter)
     {
@@ -107,6 +110,8 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
     {
     	FlexJSProject fjp = (FlexJSProject)project;
         boolean keepASDoc = fjp.config != null && fjp.config.getKeepASDoc();
+        if (fjp.config != null)
+        	emitExports = fjp.config.getExportPublicSymbols();
         
         coercionList = null;
         ignoreList = null;
@@ -432,4 +437,11 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
         end();
     }
 
+    @Override
+    public void emitPublic(IASNode node)
+    {
+    	if (emitExports)
+    		super.emitPublic(node);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d69cf6c7/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 77377c9..c42c3f5 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -122,6 +122,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     private StringBuilder subDocuments = new StringBuilder();
     private ArrayList<String> subDocumentNames = new ArrayList<String>();
     private String interfaceList;
+    private boolean emitExports = true;
     
     /**
      * This keeps track of the entries in our temporary array of 
@@ -510,6 +511,10 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     @Override
     public void emitDocument(IMXMLDocumentNode node)
     {
+        FlexJSProject fjp = (FlexJSProject) getMXMLWalker().getProject();
+    	if (fjp.config != null)
+    		emitExports = fjp.config.getExportPublicSymbols();
+    	
         descriptorTree = new ArrayList<MXMLDescriptorSpecifier>();
         propertiesTree = new MXMLDescriptorSpecifier();
 
@@ -749,7 +754,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             root.isTopNode = true;
     
 	        writeNewline("/**");
-	        writeNewline(" * @export");
+	        if (emitExports)
+	        	writeNewline(" * @export");
 	        writeNewline(" * @type {Array}");
 	        writeNewline(" */");
 	        writeNewline("this.mxmlsd = " + ASEmitterTokens.SQUARE_OPEN.getToken());
@@ -1135,7 +1141,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         .getASEmitter();
 
         writeNewline("/**");
-        writeNewline(" * @export");
+        writeNewline(" * @export"); // must export or else GCC will remove it
         writeNewline(" */");
         writeNewline(formatQualifiedName(cname)
                 + ".prototype._bindings = [");
@@ -1536,7 +1542,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         for (MXMLEventSpecifier event : events)
         {
             writeNewline("/**");
-            writeNewline(" * @export");
+	        if (emitExports)
+	        	writeNewline(" * @export");
             writeNewline(" * @param {" + formatQualifiedName(event.type) + "} event");
             writeNewline(" */");
             writeNewline(formatQualifiedName(cname)
@@ -1598,7 +1605,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                     .getToken()))
             {
                 indentPush();
-                writeNewline("/** @export */");
+    	        if (emitExports)
+    	        	writeNewline("/** @export */");
                 writeNewline(instance.id + ": {");
                 writeNewline("/** @this {" + formattedCName + "} */");
                 indentPush();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d69cf6c7/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/goog/JSGoogCompcConfiguration.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/goog/JSGoogCompcConfiguration.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/goog/JSGoogCompcConfiguration.java
index ab690e4..ebf3a21 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/goog/JSGoogCompcConfiguration.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/goog/JSGoogCompcConfiguration.java
@@ -403,5 +403,25 @@ public class JSGoogCompcConfiguration extends JSConfiguration
         keepCodeWithMetadata.addAll(values);
     }
 
+    //
+    // 'export-public-symbols'
+    //
+
+    private boolean exportPublicSymbols = true;
+
+    public boolean getExportPublicSymbols()
+    {
+        return exportPublicSymbols;
+    }
+
+    @Config
+    @Mapping("export-public-symbols")
+    public void setExportPublicSymbols(ConfigurationValue cv, boolean value)
+            throws ConfigurationException
+    {
+    	exportPublicSymbols = value;
+    }
+
+    
 
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d69cf6c7/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
index 318c90b..f1ccd4d 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/goog/JSGoogConfiguration.java
@@ -402,5 +402,26 @@ public class JSGoogConfiguration extends JSConfiguration
         keepCodeWithMetadata.addAll(values);
     }
 
+    //
+    // 'export-public-symbols'
+    //
+
+    private boolean exportPublicSymbols = true;
+
+    public boolean getExportPublicSymbols()
+    {
+        return exportPublicSymbols;
+    }
+
+    @Config
+    @Mapping("export-public-symbols")
+    public void setExportPublicSymbols(ConfigurationValue cv, boolean value)
+            throws ConfigurationException
+    {
+    	exportPublicSymbols = value;
+    }
+
+    
+    
 
 }


Mime
View raw message