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

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


The following commit(s) were added to refs/heads/develop by this push:
     new 8e40298  fix nested XMLList binding. Fixes apache/royale-asjs#545
8e40298 is described below

commit 8e402984e15923ea18a9ba70fa4ecbabaead1836
Author: Alex Harui <aha...@apache.org>
AuthorDate: Sat Nov 9 23:51:34 2019 -0800

    fix nested XMLList binding. Fixes apache/royale-asjs#545
---
 .../compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java    | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
index 7e9747f..baa165a 100644
--- 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
+++ 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
@@ -1692,6 +1692,9 @@ public class MXMLRoyaleEmitter extends MXMLEmitter 
implements
                InstructionListNode ilNode = 
(InstructionListNode)destNode.getExpressionNode();
                InstructionList il = ilNode.getInstructions();
                ArrayList<Instruction> abcs = il.getInstructions();
+               // the first indexed access accesses an XMLList, the next ones
+               // access an XML object
+               boolean indexedAccess = false;
                int n = abcs.size();
                for (int i = 0; i < n; i++)
                {
@@ -1715,7 +1718,10 @@ public class MXMLRoyaleEmitter extends MXMLEmitter 
implements
                                        try
                                    {
                                        
Integer.parseInt(propName.getBaseName());
+                                       if (indexedAccess)
+                                               sb.append(".children()");
                                        sb.append("[" + propName.getBaseName() 
+ "]" );
+                                       indexedAccess = true;
                                    } catch (NumberFormatException ex)
                                    {
                                        sb.append(".elements(" + 
propName.getBaseName() + ")" );

Reply via email to