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:52 UTC

[royale-compiler] branch develop updated (e78dbcf -> 9aeb984)

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git.


    from e78dbcf  special case XML == true/false.  Partial fix for apache/royale-asjs#819
     new f197057  ClosureUtils: prevent rename public/protected symbols must include accessors in the set if export public/protected is disabled
     new 9aeb984  ClosureUtils: refactor collectSymbolNamesToExport() to better match collectPropertyNamesToKeep()

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/royale/compiler/utils/ClosureUtils.java | 64 +++++++++++++---------
 1 file changed, 39 insertions(+), 25 deletions(-)


[royale-compiler] 01/02: ClosureUtils: prevent rename public/protected symbols must include accessors in the set if export public/protected is disabled

Posted by jo...@apache.org.
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());
                         }
                     }
                 }


[royale-compiler] 02/02: ClosureUtils: refactor collectSymbolNamesToExport() to better match collectPropertyNamesToKeep()

Posted by jo...@apache.org.
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 9aeb984fb7f9c1afd73e21007ceaa16cb383b538
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon May 11 12:08:49 2020 -0700

    ClosureUtils: refactor collectSymbolNamesToExport() to better match collectPropertyNamesToKeep()
    
    Currently still limited to types and public static methods, though. Will slowly switch over more exports later.
---
 .../apache/royale/compiler/utils/ClosureUtils.java | 30 ++++++++++++++++------
 1 file changed, 22 insertions(+), 8 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 a1ae12f..78c2ea7 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
@@ -116,6 +116,8 @@ public class ClosureUtils
         {
             return;
         }
+        boolean exportPublic = project.config != null && project.config.getExportPublicSymbols();
+        boolean exportProtected = project.config != null && project.config.getExportProtectedSymbols();
         try
         {
             String parentQName = null;
@@ -161,17 +163,29 @@ public class ClosureUtils
                             continue;
                         }
 
-                        for(IDefinition childDef : typeDef.getContainedScope().getAllLocalDefinitions())
+                        for(IDefinition localDef : typeDef.getContainedScope().getAllLocalDefinitions())
                         {
-                            if(childDef instanceof IFunctionDefinition && !(childDef instanceof IVariableDefinition) && childDef.isStatic() && childDef.isPublic())
+                            if (localDef.isImplicit())
                             {
-                                if(isFilePrivate)
-                                {
-                                    filePrivateNames.add(qualifiedName + "." + childDef.getBaseName());
-                                }
-                                else
+                                continue;
+                            }
+                            INamespaceReference nsRef = localDef.getNamespaceReference();
+                            boolean isPublic = nsRef instanceof INamespaceDefinition.IPublicNamespaceDefinition;
+                            boolean isProtected = nsRef instanceof INamespaceDefinition.IProtectedNamespaceDefinition
+                                    || nsRef instanceof INamespaceDefinition.IStaticProtectedNamespaceDefinition;
+                            if (localDef instanceof IFunctionDefinition && !(localDef instanceof IVariableDefinition)
+                                    && localDef.isStatic() && isPublic)
+                            {
+                                if ((isPublic && exportPublic) || (isProtected && exportProtected))
                                 {
-                                    symbolsResult.add(qualifiedName + "." + childDef.getBaseName());
+                                    if (isFilePrivate)
+                                    {
+                                        filePrivateNames.add(qualifiedName + "." + localDef.getBaseName());
+                                    }
+                                    else
+                                    {
+                                        symbolsResult.add(qualifiedName + "." + localDef.getBaseName());
+                                    }
                                 }
                             }
                         }