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

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

commit e38ce64d6211e147f28ccb9abb85ecbd7d4e7218
Author: Josh Tynjala <[email protected]>
AuthorDate: Thu Feb 18 10:16:20 2021 -0800

    ABCGenerator: fix issue where the return type of a native method 
incorrectly set a qname as the base name, instead of separating out the package 
into a namespace
---
 .../royale/compiler/internal/as/codegen/ABCGenerator.java   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/ABCGenerator.java
 
b/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/ABCGenerator.java
index 7e93f95..bfca01a 100644
--- 
a/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/ABCGenerator.java
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/ABCGenerator.java
@@ -39,6 +39,7 @@ import org.apache.royale.abc.instructionlist.InstructionList;
 import org.apache.royale.abc.semantics.MethodBodyInfo;
 import org.apache.royale.abc.semantics.MethodInfo;
 import org.apache.royale.abc.semantics.Name;
+import org.apache.royale.abc.semantics.Namespace;
 import org.apache.royale.abc.semantics.PooledValue;
 import org.apache.royale.abc.visitors.IMethodBodyVisitor;
 import org.apache.royale.abc.visitors.IMethodVisitor;
@@ -325,7 +326,17 @@ public class ABCGenerator implements ICodeGenerator
         // but for native types, as the burm isn't run, we need to set
         // the return type here.
         String returnType = func.getReturnType();
-        mi.setReturnType(new Name(returnType));
+        int lastDotIndex = returnType.lastIndexOf('.');
+        if (lastDotIndex != -1)
+        {
+            Namespace ns = new Namespace(CONSTANT_PackageNs, 
returnType.substring(0, lastDotIndex));
+            String baseName = returnType.substring(lastDotIndex + 1);
+            mi.setReturnType(new Name(ns, baseName));
+        }
+        else
+        {
+            mi.setReturnType(new Name(returnType));
+        }
         
         mv.visitEnd();
     }

Reply via email to