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 f8d73d2  handle children of toptags that are instances but the top tag 
doesn't have a default property.  Such as Cairngorm's ServiceLocator
f8d73d2 is described below

commit f8d73d2ba15aa824626cea94116e5bf82288d7ff
Author: Alex Harui <[email protected]>
AuthorDate: Thu Feb 6 10:59:26 2020 -0800

    handle children of toptags that are instances but the top tag doesn't have 
a default property.  Such as Cairngorm's ServiceLocator
---
 .../internal/codegen/mxml/royale/MXMLRoyaleEmitter.java  | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

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 9d1fa86..b89850d 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
@@ -2342,8 +2342,20 @@ public class MXMLRoyaleEmitter extends MXMLEmitter 
implements
             descriptorTree.add(currentInstance);
         else
         {
-            currentInstance.parent = propertiesTree;
-            propertiesTree.propertySpecifiers.add(currentInstance);
+               // we get here if a instance is a child of a top-level tag
+               // and there is no default property.  If there are other
+               // ways to get here, then the code will need adjusting.
+               
+               // this code assumes that the children will have an id
+               // and will just create properties with the children's id
+               // on the class.
+               MXMLDescriptorSpecifier prop = new MXMLDescriptorSpecifier();
+               prop.isProperty = true;
+               prop.name = id;
+               prop.parent = propertiesTree;
+               propertiesTree.propertySpecifiers.add(prop);
+            currentInstance.parent = prop;
+            prop.propertySpecifiers.add(currentInstance);
         }
 
         addInstanceIfNeeded(instances, currentInstance);

Reply via email to