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] - FLEX-34983 Fix JSDoc output
Date Fri, 11 Dec 2015 17:56:48 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 4119ceae2 -> b5e8f73d1


FLEX-34983 Fix JSDoc 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/b5e8f73d
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/b5e8f73d
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/b5e8f73d

Branch: refs/heads/develop
Commit: b5e8f73d1396e83290ad29b57a15db1fe5287673
Parents: 4119cea
Author: Alex Harui <aharui@apache.org>
Authored: Fri Dec 11 09:56:37 2015 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Dec 11 09:56:37 2015 -0800

----------------------------------------------------------------------
 .../js/flexjs/TestFlexJSExpressions.java        | 10 ++++++
 .../externals/reference/BaseReference.java      | 38 +++++++++++++++++---
 .../codegen/js/goog/JSGoogDocEmitter.java       | 10 ++++--
 3 files changed, 51 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b5e8f73d/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 76d48dc..c7d02ea 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
@@ -831,6 +831,16 @@ public class TestFlexJSExpressions extends TestGoogExpressions
         assertOut("/**\n * @export\n * @param {Object} o\n * @return {number}\n */\nfoo.bar.B.prototype.b
= function(o) {\n  var /** @type {foo.bar.B} */ a;\n  a = org.apache.flex.utils.Language.as(o,
foo.bar.B);\n}");
     }
 
+    @Test
+    public void testVisitJSDoc()
+    {
+        IFunctionNode node = (IFunctionNode) getNode(
+                "public class LinkableString {public function b(o:Object):int { var a:LinkableString;
a = o as LinkableString; }}",
+                IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
+        asBlockWalker.visitFunction(node);
+        assertOut("/**\n * @export\n * @param {Object} o\n * @return {number}\n */\nfoo.bar.LinkableString.prototype.b
= function(o) {\n  var /** @type {foo.bar.LinkableString} */ a;\n  a = org.apache.flex.utils.Language.as(o,
foo.bar.LinkableString);\n}");
+    }
+
     @Override
     @Test
     public void testVisitBinaryOperator_Is()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b5e8f73d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
index aaf5479..b74167e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
@@ -200,10 +200,40 @@ public abstract class BaseReference
 
     protected String mapBackToJS(String t)
     {
-    	if (t.contains("String")) return t.replace("String", "string");
-    	if (t.contains("Number")) return t.replace("Number", "number");
-    	if (t.contains("Boolean")) return t.replace("Boolean", "boolean");
-    	if (t.contains("object")) return t.replace("object", "Object");
+    	// remove all whitespace
+    	t = t.replace(" ", "");
+    	if (t.contains("{String}")) 
+    		t = t.replace("{String}", "{string}");
+    	if (t.contains("{Number}")) 
+    		t = t.replace("{Number}", "{number}");
+    	if (t.contains("{Boolean}")) 
+    		t = t.replace("{Boolean}", "{boolean}");
+    	if (t.contains("{object")) 
+    		t = t.replace("{object}", "{Object}");
+    	if (t.contains("(String|")) 
+    		t = t.replace("(String|", "(string|");
+    	if (t.contains("(Number|")) 
+    		t = t.replace("(Number|", "(number|");
+    	if (t.contains("(Boolean|")) 
+    		t = t.replace("(Boolean|", "(boolean|");
+    	if (t.contains("(object|")) 
+    		t = t.replace("(object|", "(Object|");
+    	if (t.contains("|String|")) 
+    		t = t.replace("|String|", "|string|");
+    	if (t.contains("|Number|")) 
+    		t = t.replace("|Number|", "|number|");
+    	if (t.contains("|Boolean|")) 
+    		t = t.replace("|Boolean|", "|boolean|");
+    	if (t.contains("|object|")) 
+    		t = t.replace("|object|", "|Object|");
+    	if (t.contains("|String)")) 
+    		t = t.replace("|String)", "|string)");
+    	if (t.contains("|Number)")) 
+    		t = t.replace("|Number)", "|number)");
+    	if (t.contains("|Boolean)")) 
+    		t = t.replace("|Boolean)", "|boolean)");
+    	if (t.contains("|object)")) 
+    		t = t.replace("|object)", "|Object)");
     	return t;
     }
     

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b5e8f73d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
index 3da58b0..df762c5 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
@@ -481,6 +481,13 @@ public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
             result = IASLanguageConstants.Number.toLowerCase();
 
         boolean isBuiltinFunction = name.matches("Vector\\.<.*>");
+        if (isBuiltinFunction)
+        {
+        	// is a vector so convert the element type
+        	String elementType = name.substring(8, name.length() - 1);
+        	elementType = convertASTypeToJS(elementType, pname);
+        	name = "Vector.<" + elementType + ">";
+        }
         IASGlobalFunctionConstants.BuiltinType[] builtinTypes = IASGlobalFunctionConstants.BuiltinType
                 .values();
         for (IASGlobalFunctionConstants.BuiltinType builtinType : builtinTypes)
@@ -497,9 +504,6 @@ public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
                     + ASEmitterTokens.MEMBER_ACCESS.getToken() + name
                     : name;
 
-        result = result.replace(IASLanguageConstants.String,
-                IASLanguageConstants.String.toLowerCase());
-
         return result;
     }
 


Mime
View raw message