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 21:10:27 UTC

[royale-compiler] branch develop updated (b3f8084 -> 756e1f4)

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

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


    from b3f8084  FindRoyaleMXMLPropertyNamesToKeep: fix incorrect exception when name is not string
     new 6159732  MXMLPropertySpecifierNode: fixed Generated byte code contains an operand stack underflow error when binding to a property typed as Array in MXML using an element
     new 756e1f4  BindingInfo: fix issue where binding to MXML <fx:Array> did not work

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../royale/compiler/internal/codegen/databinding/BindingInfo.java | 8 ++++++++
 .../royale/compiler/internal/tree/mxml/MXMLDataBindingParser.java | 5 +++++
 .../compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java    | 5 ++++-
 3 files changed, 17 insertions(+), 1 deletion(-)

[royale-compiler] 02/02: BindingInfo: fix issue where binding to MXML did not work

Posted by jo...@apache.org.
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 756e1f46adf216f63cb4870f75bc781066c8a3e9
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue May 25 13:55:33 2021 -0700

    BindingInfo: fix issue where binding to MXML <fx:Array> did not work
    
    This change makes the Royale compiler match the behavior of the Flex SDK compiler
---
 .../royale/compiler/internal/codegen/databinding/BindingInfo.java | 8 ++++++++
 1 file changed, 8 insertions(+)

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 30c3c8d..d312941 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
@@ -48,6 +48,7 @@ import org.apache.royale.compiler.tree.as.IExpressionNode;
 import org.apache.royale.compiler.tree.as.IFunctionCallNode;
 import org.apache.royale.compiler.tree.as.IIdentifierNode;
 import org.apache.royale.compiler.tree.as.IMemberAccessExpressionNode;
+import org.apache.royale.compiler.tree.mxml.IMXMLArrayNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLBindingAttributeNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLBindingNode;
 import org.apache.royale.compiler.tree.mxml.IMXMLClassDefinitionNode;
@@ -304,6 +305,13 @@ public class BindingInfo implements Comparable<BindingInfo>
             assert id != null;
             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;
+        }
         else if (parent instanceof IMXMLModelPropertyNode)
         {
             // For now, we are always making a destination function, so we

[royale-compiler] 01/02: MXMLPropertySpecifierNode: fixed Generated byte code contains an operand stack underflow error when binding to a property typed as Array in MXML using an element

Posted by jo...@apache.org.
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 6159732ebc3ae759716926473cec5e4f0c0c3961
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue May 25 13:39:10 2021 -0700

    MXMLPropertySpecifierNode: fixed Generated byte code contains an operand stack underflow error when binding to a property typed as Array in MXML using an element
    
    The same error did not happen using an attribute. It was because the compiler was creating an implicit <fx:Array> element that wasn't necessary with binding.
---
 .../royale/compiler/internal/tree/mxml/MXMLDataBindingParser.java    | 5 +++++
 .../compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java       | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLDataBindingParser.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLDataBindingParser.java
index 5b3e8dc..d25b814 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLDataBindingParser.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLDataBindingParser.java
@@ -78,6 +78,11 @@ class MXMLDataBindingParser
      */
     private static final char BACKSLASH = '\\';
 
+    public static boolean willParse(ISourceFragment[] fragments)
+    {
+        return scan(fragments) != null;
+    }
+
     /**
      * Parses source fragments looking for databinding expressions.
      * <p>
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
index 89925e7..ff77c65 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
@@ -601,7 +601,10 @@ class MXMLPropertySpecifierNode extends MXMLSpecifierNodeBase implements IMXMLPr
         // then create an implicit Array tag and initialize it from the
         // child tags of the property tag.
         IDefinition definition = getDefinition();
-        if (definition != null && definition.getTypeAsDisplayString().equals(IASLanguageConstants.Array))
+        if (definition != null
+                && definition.getTypeAsDisplayString().equals(IASLanguageConstants.Array)
+                // don't crate an implicit MXML Array if the contents parse to a data binding expression -JT
+                && !MXMLDataBindingParser.willParse(info.getSourceFragments()))
         {
             if (instanceNode == null || ((!(instanceNode instanceof MXMLArrayNode)) &&
                 !instanceNode.getClassReference(project).getQualifiedName().equals(IASLanguageConstants.Array)))