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 <[email protected]> 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)))
