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] - add type annotation to interface getter/setter so GCC doesn't warn about it
Date Thu, 16 Jul 2015 00:00:52 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 34a1abcde -> 9797b6b47


add type annotation to interface getter/setter so GCC doesn't warn about it


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

Branch: refs/heads/develop
Commit: 9797b6b4774f74f31f2bf4a405f8451742441ef4
Parents: 34a1abc
Author: Alex Harui <aharui@apache.org>
Authored: Wed Jul 15 16:59:36 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Wed Jul 15 16:59:36 2015 -0700

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSInterface.java       |  4 ++--
 .../projects/interfaces/interfaces/IE_result.js      |  3 ++-
 .../compiler/codegen/js/goog/IJSGoogDocEmitter.java  |  2 ++
 .../internal/codegen/js/goog/JSGoogDocEmitter.java   |  7 +++++++
 .../internal/codegen/js/jx/InterfaceEmitter.java     | 15 +++++++++++++++
 5 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9797b6b4/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java
index 5d1028b..bacd034 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java
@@ -43,7 +43,7 @@ public class TestFlexJSInterface extends TestGoogInterface
                 + "function get foo1():Object;"
                 + "function set foo1(value:Object):void;}");
         asBlockWalker.visitInterface(node);
-        assertOut("/**\n * @interface\n */\nIA = function() {\n};\nIA.prototype.foo1;");
+        assertOut("/**\n * @interface\n */\nIA = function() {\n};\n/**  * @type {Object}\n
*/IA.prototype.foo1;");
     }
 
     @Override
@@ -67,7 +67,7 @@ public class TestFlexJSInterface extends TestGoogInterface
                 + "function baz1():Object;"
                 + "function baz2(value:Object):void;}");
         asBlockWalker.visitInterface(node);
-        assertOut("/**\n * @interface\n */\nIA = function() {\n};\nIA.prototype.foo1;\nIA.prototype.baz1
= function() {\n};\nIA.prototype.baz2 = function(value) {\n};");
+        assertOut("/**\n * @interface\n */\nIA = function() {\n};\n/**  * @type {Object}\n
*/IA.prototype.foo1;\nIA.prototype.baz1 = function() {\n};\nIA.prototype.baz2 = function(value)
{\n};");
     }
 
     protected IBackend createBackend()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9797b6b4/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
b/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
index 9c3f3be..ef07f66 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
@@ -30,7 +30,8 @@ interfaces.IE = function() {
 };
 interfaces.IE.prototype.myMethod = function() {
 };
-interfaces.IE.prototype.myProp;
+/**  * @type {string}
+ */interfaces.IE.prototype.myProp;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9797b6b4/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 f0c8817..c159428 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
@@ -135,4 +135,6 @@ public interface IJSGoogDocEmitter extends IJSDocEmitter
     void emitThis(ITypeDefinition node, String packageName);
 
     void emitType(IASNode node, String packageName);
+
+	void emitType(String type, String packageName);
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9797b6b4/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 18b0c1d..16b9aeb 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
@@ -367,6 +367,13 @@ public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
                 convertASTypeToJS(type, packageName));
     }
 
+    @Override
+    public void emitType(String type, String packageName)
+    {
+        emitJSDocLine(JSGoogDocEmitterTokens.TYPE.getToken(),
+                convertASTypeToJS(type, packageName));
+    }
+
     public void emitTypeShort(IASNode node, String packageName)
     {
         String type = ((IVariableNode) node).getVariableType();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9797b6b4/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
index d12a3ba..834e612 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
@@ -22,12 +22,15 @@ package org.apache.flex.compiler.internal.codegen.js.jx;
 import org.apache.flex.compiler.codegen.ISubEmitter;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSDocEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
 import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.as.IAccessorNode;
 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;
 
@@ -77,6 +80,18 @@ public class InterfaceEmitter extends JSSubEmitter implements
             {
                 writeNewline();
 
+                if (isAccessor)
+                {
+                	IAccessorNode accessor = (IAccessorNode)mnode;
+                	String propType = accessor.getVariableType();
+                	IExpressionNode typeNode = accessor.getVariableTypeNode();
+                	String packageName = typeNode.getPackageName();
+                    write(JSDocEmitterTokens.JSDOC_OPEN);
+                    write(ASEmitterTokens.SPACE);
+                    fjs.getDocEmitter().emitType(propType, packageName);
+                    write(ASEmitterTokens.SPACE);
+                    write(JSDocEmitterTokens.JSDOC_CLOSE);
+                }
                 write(getEmitter().formatQualifiedName(qname));
                 write(ASEmitterTokens.MEMBER_ACCESS);
                 write(JSEmitterTokens.PROTOTYPE);


Mime
View raw message