flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joshtynj...@apache.org
Subject [1/5] git commit: [flex-falcon] [refs/heads/develop] - externc: properties for typedefs are now added to emitted classes, but they are all typed as Object for now
Date Fri, 06 May 2016 19:53:11 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 1e1f6a99b -> 1be8600e8


externc: properties for typedefs are now added to emitted classes, but they are all typed
as Object for now


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

Branch: refs/heads/develop
Commit: c8cbeed2ca8f26afb7d40aaff978df32eab3aef4
Parents: 1e1f6a9
Author: Josh Tynjala <joshtynjala@gmail.com>
Authored: Fri May 6 12:31:11 2016 -0700
Committer: Josh Tynjala <joshtynjala@gmail.com>
Committed: Fri May 6 12:31:11 2016 -0700

----------------------------------------------------------------------
 .../externals/reference/ClassReference.java      | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c8cbeed2/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
index 44e1e6b..c4f890c 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
@@ -36,6 +36,7 @@ import com.google.javascript.rhino.JSDocInfoBuilder;
 import com.google.javascript.rhino.JSTypeExpression;
 import com.google.javascript.rhino.Node;
 import com.google.javascript.rhino.jstype.JSType;
+import com.google.javascript.rhino.jstype.ObjectType;
 
 public class ClassReference extends BaseReference
 {
@@ -232,6 +233,24 @@ public class ClassReference extends BaseReference
         }
         else if (comment.getTypedefType() != null)
         {
+            JSTypeExpression typeDefType = comment.getTypedefType();
+            JSType typeDefJSType = model.evaluate(typeDefType);
+            if (typeDefJSType != null)
+            {
+                ObjectType typeDefObjectType = typeDefJSType.toObjectType();
+                if (typeDefObjectType != null)
+                {
+                    Map<String,JSType> properties = typeDefObjectType.getPropertyTypeMap();
+                    for (Map.Entry<String, JSType> property : properties.entrySet())
+                    {
+                        JSType propertyType = property.getValue();
+                        JSDocInfoBuilder b = new JSDocInfoBuilder(true);
+                        b.recordBlockDescription("Generated doc for missing field JSDoc.");
+                        JSDocInfo fieldComment = b.build();
+                        addField(node, property.getKey(), fieldComment, false);
+                    }
+                }
+            }
             //System.out.println(node.toStringTree());
             /*
              VAR 727 [jsdoc_info: JSDocInfo] [source_file: [w3c_rtc]] [length: 21]


Mime
View raw message