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/11 19:13:53 UTC
[royale-compiler] 01/02: ClosureUtils: prevent rename
public/protected symbols must include accessors in the set if export
public/protected is disabled
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 f197057c1bdb4b03bbac4bbca6135b278cb2d6d3
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon May 11 10:36:56 2020 -0700
ClosureUtils: prevent rename public/protected symbols must include accessors in the set if export public/protected is disabled
---
.../apache/royale/compiler/utils/ClosureUtils.java | 34 +++++++++++-----------
1 file changed, 17 insertions(+), 17 deletions(-)
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 0dccf19..a1ae12f 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
@@ -23,6 +23,7 @@ import java.util.LinkedHashSet;
import java.util.Set;
import org.apache.royale.compiler.asdoc.royale.ASDocComment;
+import org.apache.royale.compiler.definitions.IAccessorDefinition;
import org.apache.royale.compiler.definitions.IDefinition;
import org.apache.royale.compiler.definitions.IFunctionDefinition;
import org.apache.royale.compiler.definitions.INamespaceDefinition;
@@ -44,8 +45,10 @@ public class ClosureUtils
{
return;
}
- boolean preventRenamePublic = project.config.getPreventRenamePublicSymbols();
- boolean preventRenameProtected = project.config.getPreventRenameProtectedSymbols();
+ boolean preventRenamePublic = project.config != null && project.config.getPreventRenamePublicSymbols();
+ boolean preventRenameProtected = project.config != null && project.config.getPreventRenameProtectedSymbols();
+ boolean exportPublic = project.config != null && project.config.getExportPublicSymbols();
+ boolean exportProtected = project.config != null && project.config.getExportProtectedSymbols();
try
{
for(IASScope scope : cu.getFileScopeRequest().get().getScopes())
@@ -83,23 +86,20 @@ public class ClosureUtils
boolean isProtected = nsRef instanceof INamespaceDefinition.IProtectedNamespaceDefinition
|| nsRef instanceof INamespaceDefinition.IStaticProtectedNamespaceDefinition;
- if (!isPublic && !isProtected)
+ if ((isPublic && preventRenamePublic) || (isProtected && preventRenameProtected))
{
- continue;
- }
- if (isProtected && !preventRenameProtected)
- {
- continue;
- }
- if (isPublic && !preventRenamePublic)
- {
- continue;
- }
- if (localDef instanceof IVariableDefinition && localDef instanceof IFunctionDefinition)
- {
- continue;
+ if (localDef instanceof IAccessorDefinition)
+ {
+ if ((isPublic && exportPublic) || (isProtected && exportProtected))
+ {
+ //if an accessor is exported, we don't
+ //need to prevent renaming
+ //(not true for other symbol types)
+ continue;
+ }
+ }
+ result.add(localDef.getBaseName());
}
- result.add(localDef.getBaseName());
}
}
}