You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/11/04 22:23:26 UTC

[royale-compiler] branch develop updated: get static deps from script block. Fixes #544

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 245a1f7  get static deps from script block.  Fixes #544
245a1f7 is described below

commit 245a1f7246c8ef4bf32feeff3365c016bae49edf
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Nov 4 11:01:43 2019 -0800

    get static deps from script block.  Fixes #544
---
 .../codegen/mxml/royale/MXMLRoyaleEmitter.java     | 23 ++++++++++++++++++++--
 1 file changed, 21 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 f884b99..67ca0cd 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
@@ -176,8 +176,7 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
     {
         IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker()).getASEmitter();
         ArrayList<String> asEmitterUsedNames = ((JSRoyaleEmitter)asEmitter).usedNames;
-        JSRoyaleEmitter fjs = (JSRoyaleEmitter) ((IMXMLBlockWalker) getMXMLWalker())
-                .getASEmitter();
+        JSRoyaleEmitter fjs = (JSRoyaleEmitter)asEmitter;
 
         String currentClassName = fjs.getModel().getCurrentClass().getQualifiedName();
         ArrayList<String> removals = new ArrayList<String>();
@@ -198,6 +197,26 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
             System.out.println(currentClassName + " mxml: " + usedNames.toString());
         }
         usedNames.addAll(asEmitterUsedNames);
+        
+        ArrayList<String> asStaticEmitterUsedNames = ((JSRoyaleEmitter)asEmitter).staticUsedNames;
+        removals = new ArrayList<String>();
+        for (String usedName : asStaticEmitterUsedNames) {
+            //remove any internal component that has been registered with the other emitter's usedNames
+            if (usedName.startsWith(currentClassName+".") && subDocumentNames.contains(usedName.substring(currentClassName.length()+1))) {
+                removals.add(usedName);
+            }
+        }
+        for (String usedName : removals)
+        {
+        	asStaticEmitterUsedNames.remove(usedName);
+        }
+        if (fjp.config == null || fjp.config.isVerbose())
+        {
+            System.out.println(currentClassName + " as: " + asStaticEmitterUsedNames.toString());
+            System.out.println(currentClassName + " mxml: " + staticUsedNames.toString());
+        }
+        staticUsedNames.addAll(asStaticEmitterUsedNames);
+        
 
         boolean foundXML = false;
     	String[] lines = output.split("\n");