This is an automated email from the ASF dual-hosted git repository.
gregdove 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 f212062 Fix for issue #185 : RoyaleArrayLike iteration when there is
an implicit Content block in the original code.
f212062 is described below
commit f212062df1c39db1614c12ed7028ab555e2f74d5
Author: greg-dove <[email protected]>
AuthorDate: Thu Jun 17 16:54:34 2021 +1200
Fix for issue #185 : RoyaleArrayLike iteration when there is an implicit
Content block in the original code.
---
compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java
b/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java
index c1da300..dce1874 100644
--- a/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java
+++ b/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java
@@ -933,6 +933,14 @@ class ArrayLikeLoopMutation implements
ForLoopNode.ILoopMutation {
BlockNode block = target.getContentsNode();
//'insert' at position 0 to prepend this to the original loop's block
content
block.addChild(iteratee, 0);
+ //if a) the child count was one previously [it is now 2] *and* b) it
was an implicit Block
+ if (block.getChildCount() == 2 && block.getContainerType() ==
IContainerNode.ContainerType.IMPLICIT) {
+ //we set it as 'explicit' even though it is not. This is
particularly helpful in implementations like compiler-jx because it
+ //provides a clue for expression of the loop content with explicit
block braces, instead of as it is in the original
+ //code where they were not needed. For swf bytecode expression
this change is not needed, but also has no downside.
+ block.setContainerType(IContainerNode.ContainerType.BRACES);
+ }
+
EnumSet<PostProcessStep> set = EnumSet.of(
PostProcessStep.POPULATE_SCOPE);
//only add the iteratee to the analysis. re-evaluating the original
variable node (if it is not a pre-existing identifier)