You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2020/05/26 21:40:36 UTC

[royale-compiler] 05/05: ClosureUtils: better rename prevention and export symbol calls for package-level variables

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 10f6ef0d2ef8a73e4568146a8d20bd2e550bf84d
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue May 26 14:40:18 2020 -0700

    ClosureUtils: better rename prevention and export symbol calls for package-level variables
---
 .../apache/royale/compiler/utils/ClosureUtils.java    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/utils/ClosureUtils.java b/compiler-jx/src/main/java/org/apache/royale/compiler/utils/ClosureUtils.java
index 819af3c..c1323d4 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/utils/ClosureUtils.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/utils/ClosureUtils.java
@@ -30,6 +30,7 @@ import org.apache.royale.compiler.definitions.INamespaceDefinition;
 import org.apache.royale.compiler.definitions.IPackageDefinition;
 import org.apache.royale.compiler.definitions.ITypeDefinition;
 import org.apache.royale.compiler.definitions.IVariableDefinition;
+import org.apache.royale.compiler.definitions.IVariableDefinition.VariableClassification;
 import org.apache.royale.compiler.definitions.references.INamespaceReference;
 import org.apache.royale.compiler.internal.codegen.js.utils.DocEmitterUtils;
 import org.apache.royale.compiler.internal.projects.RoyaleJSProject;
@@ -68,6 +69,14 @@ public class ClosureUtils
                         //file-private symbols are emitted like static variables
                         result.add(def.getBaseName());
                     }
+                    if (def instanceof IVariableDefinition
+                            && !(def instanceof IAccessorDefinition))
+                    {
+                        IVariableDefinition varDef = (IVariableDefinition) def;
+                        if (varDef.getVariableClassification().equals(VariableClassification.PACKAGE_MEMBER)) {
+                            result.add(def.getBaseName());
+                        }
+                    }
                     if (def instanceof ITypeDefinition)
                     {
                         if (def.isImplicit() || def.isNative())
@@ -148,6 +157,16 @@ public class ClosureUtils
                     }
                     else
                     {
+                        if (def instanceof IVariableDefinition
+                                && !(def instanceof IAccessorDefinition))
+                        {
+                            IVariableDefinition varDef = (IVariableDefinition) def;
+                            if (varDef.getVariableClassification().equals(VariableClassification.PACKAGE_MEMBER)
+                                    && varDef.getPackageName() != null
+                                    && varDef.getPackageName().length() > 0) {
+                                symbolsResult.add(def.getPackageName());
+                            }
+                        }
                         symbolsResult.add(qualifiedName);
                         if(parentQName == null)
                         {