You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2021/02/18 23:15:18 UTC

[royale-compiler] 03/08: ABCGenerator: fix issue where native methods did not include default argument values in bytecode

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 2fb42a768c19a8bf3d53c442ac0751cbe1404f3d
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Thu Feb 18 10:17:22 2021 -0800

    ABCGenerator: fix issue where native methods did not include default argument values in bytecode
---
 .../apache/royale/compiler/internal/as/codegen/ABCGenerator.java    | 6 ++++++
 1 file changed, 6 insertions(+)

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 bfca01a..14c75c1 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
@@ -262,6 +262,9 @@ public class ABCGenerator implements ICodeGenerator
         MethodInfo mi = createMethodInfo(enclosing_scope, func, alternate_name);
         if (mi.isNative())
         {
+            // previous versions didn't add the default argument values to
+            // native methods, but that led to broken signatures -JT
+            mi = createMethodInfoWithOptionalDefaultArgumentValues(enclosing_scope, func, true, alternate_name);
             generateNativeMethod(func, mi, enclosing_scope);
         }
         else
@@ -294,6 +297,9 @@ public class ABCGenerator implements ICodeGenerator
         MethodInfo mi = createMethodInfo(enclosing_scope, func, null);
         if (mi.isNative())
         {
+            // previous versions didn't add the default argument values to
+            // native methods, but that led to broken signatures -JT
+            mi = createMethodInfoWithOptionalDefaultArgumentValues(enclosing_scope, func, true, null);
             generateNativeMethod(func, mi, enclosing_scope);
             return new GenerateFunctionInParallelResult(Futures.immediateFuture(null), mi, Collections.<IVisitor>emptyList());
         }