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/05/25 22:06:49 UTC

[royale-compiler] 02/02: BindingInfo: fixed that destination string was missing this. when binding directly to MXML primitives like Array/String/Number

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 8049d70b3050bc88a9b987038c456cf19dc0d91c
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue May 25 14:57:30 2021 -0700

    BindingInfo: fixed that destination string was missing this. when binding directly to MXML primitives like Array/String/Number
---
 .../internal/codegen/databinding/BindingInfo.java  | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/codegen/databinding/BindingInfo.java b/compiler/src/main/java/org/apache/royale/compiler/internal/codegen/databinding/BindingInfo.java
index d312941..fc907de 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/codegen/databinding/BindingInfo.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/codegen/databinding/BindingInfo.java
@@ -303,14 +303,36 @@ public class BindingInfo implements Comparable<BindingInfo>
             // We are an MXML primitive (like sf:String), so the dest string is just our ID
             String id = ((IMXMLExpressionNode)parent).getEffectiveID();
             assert id != null;
-            destString = id;
+
+            IMXMLClassReferenceNode propertyParent = (IMXMLClassReferenceNode)
+                    parent.getAncestorOfType(IMXMLClassReferenceNode.class);  
+            assert propertyParent != null;
+            if (propertyParent instanceof IMXMLClassDefinitionNode)
+            {
+                destString = "this." + id;
+            }
+            else
+            {
+                destString = id;
+            }
         }
         else if (parent instanceof IMXMLArrayNode)
         {
             // We are an MXML primitive, so the dest string is just our ID
             String id = ((IMXMLArrayNode)parent).getEffectiveID();
             assert id != null;
-            destString = id;
+
+            IMXMLClassReferenceNode propertyParent = (IMXMLClassReferenceNode)
+                    parent.getAncestorOfType(IMXMLClassReferenceNode.class);  
+            assert propertyParent != null;
+            if (propertyParent instanceof IMXMLClassDefinitionNode)
+            {
+                destString = "this." + id;
+            }
+            else
+            {
+                destString = id;
+            }
         }
         else if (parent instanceof IMXMLModelPropertyNode)
         {