flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From josebarra...@apache.org
Subject [22/50] git commit: [flex-falcon] [refs/heads/maven] - Proper JSDoc annotations for interface members.
Date Fri, 28 Feb 2014 09:48:19 GMT
Proper JSDoc annotations for interface members.

Signed-off-by: Erik de Bruin <erik@ixsoftware.nl>


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

Branch: refs/heads/maven
Commit: 17ccd49c9510102d7507cea0ef92730190e44e82
Parents: dfa5892
Author: Erik de Bruin <erik@ixsoftware.nl>
Authored: Fri Dec 6 11:15:21 2013 +0100
Committer: Erik de Bruin <erik@ixsoftware.nl>
Committed: Fri Dec 6 11:15:21 2013 +0100

----------------------------------------------------------------------
 .../codegen/js/goog/IJSGoogDocEmitter.java      |  3 ++
 .../codegen/js/flexjs/JSFlexJSDocEmitter.java   | 41 ++++++++++++++++++++
 .../codegen/js/flexjs/JSFlexJSEmitter.java      |  2 +
 .../codegen/js/goog/JSGoogDocEmitter.java       |  7 ++++
 4 files changed, 53 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/17ccd49c/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
index b3d3ad9..6903da8 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
@@ -25,6 +25,7 @@ import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
 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.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IInterfaceNode;
 import org.apache.flex.compiler.tree.as.IParameterNode;
@@ -51,6 +52,8 @@ public interface IJSGoogDocEmitter extends IJSDocEmitter
 
     void emitInterfaceDoc(IInterfaceNode node, ICompilerProject project);
 
+    void emitInterfaceMemberDoc(IDefinitionNode node, ICompilerProject project);
+    
     void emitFieldDoc(IVariableNode node, IDefinition def);
 
     void emitMethodDoc(IFunctionNode node, ICompilerProject project);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/17ccd49c/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
index adb3b60..ab75379 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
@@ -34,6 +34,7 @@ import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogDocEmitter;
 import org.apache.flex.compiler.internal.definitions.InterfaceDefinition;
 import org.apache.flex.compiler.internal.scopes.ASScope;
 import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IParameterNode;
@@ -153,6 +154,46 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
                 end();
         }
     }
+    
+    public void emitInterfaceMemberDoc(IDefinitionNode node, ICompilerProject project)
+    {
+        boolean hasDoc = false;
+        
+        String returnType = ((IFunctionNode) node).getReturnType();
+        if (returnType != ""
+                && returnType != ASEmitterTokens.VOID.getToken()) // has return
+        {
+            begin();
+            hasDoc = true;
+
+            ITypeDefinition tdef = ((IFunctionDefinition)node.getDefinition())
+                    .resolveReturnType(project);
+
+            String packageName = "";
+            if (tdef instanceof InterfaceDefinition)
+                packageName = tdef.getPackageName();
+            else
+                packageName = node.getPackageName();
+            
+            emitReturn((IFunctionNode) node, packageName);
+        }
+
+        IParameterNode[] parameters = ((IFunctionNode) node).getParameterNodes();
+        for (IParameterNode pnode : parameters)
+        {
+            if (!hasDoc)
+            {
+                begin();
+                hasDoc = true;
+            }
+
+            IExpressionNode enode = pnode.getNameExpressionNode();
+            emitParam(pnode, enode.resolveType(project).getPackageName());
+        }
+
+        if (hasDoc)
+            end();
+    }
 
     @Override
     public void emitMethodAccess(IFunctionNode node)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/17ccd49c/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 947a268..e2d26f1 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -230,6 +230,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
             writeNewline();
             writeNewline();
 
+            getDoc().emitInterfaceMemberDoc((IFunctionNode) mnode, project);
+            
             write(qname);
             write(ASEmitterTokens.MEMBER_ACCESS);
             write(JSEmitterTokens.PROTOTYPE);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/17ccd49c/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 915265a..1ca5781 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
@@ -42,6 +42,7 @@ import org.apache.flex.compiler.internal.semantics.SemanticUtils;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IClassNode;
+import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IInterfaceNode;
@@ -94,6 +95,12 @@ public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
         end();
     }
 
+    public void emitInterfaceMemberDoc(IDefinitionNode node, ICompilerProject project)
+    {
+        // (erikdebruin) placeholder method, so we don't have to further complicate
+        //               the interface structure
+    }
+
     @Override
     public void emitFieldDoc(IVariableNode node, IDefinition def)
     {


Mime
View raw message