This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit e8c6a62ee2ace622d90f932da6f00e2410d55a49
Author: Alex Harui <aha...@apache.org>
AuthorDate: Thu Feb 22 09:41:44 2018 -0800

    we've been outputting incorrect interfaces for a while now.  This should 
fix it
---
 .../internal/codegen/js/jx/InterfaceEmitter.java        | 17 +++++++++++------
 .../internal/codegen/js/royale/TestRoyaleInterface.java |  4 ++--
 .../royale/projects/overrides/interfaces/IA_result.js   |  6 ++++++
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/InterfaceEmitter.java
 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/InterfaceEmitter.java
index 2f4f2b8..0221afc 100644
--- 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/InterfaceEmitter.java
+++ 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/InterfaceEmitter.java
@@ -72,10 +72,10 @@ public class InterfaceEmitter extends JSSubEmitter 
implements
             write(ASEmitterTokens.SEMICOLON);
         }
 
+        JSRoyaleDocEmitter doc = (JSRoyaleDocEmitter) getEmitter()
+        .getDocEmitter();
            if (!getEmitter().getModel().isExterns)
            {
-               JSRoyaleDocEmitter doc = (JSRoyaleDocEmitter) getEmitter()
-               .getDocEmitter();
                    writeNewline();
                    writeNewline();
                    writeNewline();
@@ -100,8 +100,9 @@ public class InterfaceEmitter extends JSSubEmitter 
implements
             boolean isAccessor = mnode.getNodeID() == ASTNodeID.GetterID
                     || mnode.getNodeID() == ASTNodeID.SetterID;
 
+            String memberName = mnode.getQualifiedName();
             if (!isAccessor
-                    || !getModel().getInterfacePropertyMap().contains(qname))
+                    || 
!getModel().getInterfacePropertyMap().contains(memberName))
             {
                 writeNewline();
 
@@ -119,17 +120,21 @@ public class InterfaceEmitter extends JSSubEmitter 
implements
                     write(ASEmitterTokens.SPACE);
                     write(JSDocEmitterTokens.JSDOC_CLOSE);
                 }
+                else
+                {
+                       doc.emitMethodDoc((IFunctionNode)mnode, project);
+                }
                 write(getEmitter().formatQualifiedName(qname));
                 write(ASEmitterTokens.MEMBER_ACCESS);
                 write(JSEmitterTokens.PROTOTYPE);
                 write(ASEmitterTokens.MEMBER_ACCESS);
-                write(mnode.getQualifiedName());
+                write(memberName);
 
                 if (isAccessor
                         && !getModel().getInterfacePropertyMap()
-                                .contains(qname))
+                                .contains(memberName))
                 {
-                    getModel().getInterfacePropertyMap().add(qname);
+                    getModel().getInterfacePropertyMap().add(memberName);
                 }
                 else
                 {
diff --git 
a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleInterface.java
 
b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleInterface.java
index d6bca65..2ee8941 100644
--- 
a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleInterface.java
+++ 
b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleInterface.java
@@ -90,7 +90,7 @@ public class TestRoyaleInterface extends TestGoogInterface
                 + "function baz1():Object;"
                 + "function baz2(value:Object):void;}");
         asBlockWalker.visitInterface(node);
-        assertOut("/**\n * @interface\n */\nIA = function() {\n};\n\n\n/**\n * 
Prevent renaming of class. Needed for reflection.\n */\ngoog.exportSymbol('IA', 
IA);\nIA.prototype.baz1 = function() {\n};\nIA.prototype.baz2 = function(value) 
{\n};");
+        assertOut("/**\n * @interface\n */\nIA = function() {\n};\n\n\n/**\n * 
Prevent renaming of class. Needed for reflection.\n */\ngoog.exportSymbol('IA', 
IA);\n/**\n * @return {Object}\n */\nIA.prototype.baz1 = function() 
{\n};\n/**\n * @param {Object} value\n */\nIA.prototype.baz2 = function(value) 
{\n};");
     }
 
     @Override
@@ -103,7 +103,7 @@ public class TestRoyaleInterface extends TestGoogInterface
                 + "function baz1():Object;"
                 + "function baz2(value:Object):void;}");
         asBlockWalker.visitInterface(node);
-        assertOut("/**\n * @interface\n */\nIA = function() {\n};\n\n\n/**\n * 
Prevent renaming of class. Needed for reflection.\n */\ngoog.exportSymbol('IA', 
IA);\n/**  * @type {Object}\n */IA.prototype.foo1;\nIA.prototype.baz1 = 
function() {\n};\nIA.prototype.baz2 = function(value) {\n};");
+        assertOut("/**\n * @interface\n */\nIA = function() {\n};\n\n\n/**\n * 
Prevent renaming of class. Needed for reflection.\n */\ngoog.exportSymbol('IA', 
IA);\n/**  * @type {Object}\n */IA.prototype.foo1;\n/**\n * @return {Object}\n 
*/\nIA.prototype.baz1 = function() {\n};\n/**\n * @param {Object} value\n 
*/\nIA.prototype.baz2 = function(value) {\n};");
     }
 
     protected IBackend createBackend()
diff --git 
a/compiler-jx/src/test/resources/royale/projects/overrides/interfaces/IA_result.js
 
b/compiler-jx/src/test/resources/royale/projects/overrides/interfaces/IA_result.js
index f71d6ca..0a73f33 100644
--- 
a/compiler-jx/src/test/resources/royale/projects/overrides/interfaces/IA_result.js
+++ 
b/compiler-jx/src/test/resources/royale/projects/overrides/interfaces/IA_result.js
@@ -37,8 +37,14 @@ interfaces.IA = function() {
  * Prevent renaming of class. Needed for reflection.
  */
 goog.exportSymbol('interfaces.IA', interfaces.IA);
+/**
+ * @return {classes.B}
+ */
 interfaces.IA.prototype.someFunction = function() {
 };
+/**
+ * @return {interfaces.IB}
+ */
 interfaces.IA.prototype.someOtherFunction = function() {
 };
 

-- 
To stop receiving notification emails like this one, please contact
aha...@apache.org.

Reply via email to