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


The following commit(s) were added to refs/heads/develop by this push:
     new 3310e6e65 FunctionDefinition: fixed incorrect 
ConflictingDefinitionProblem when there's a method in a language namespace 
(like public/protected) and a method in non-language namespace (like 
mx_internal)
3310e6e65 is described below

commit 3310e6e65b9c5746eec2757456463cd14a954767
Author: Josh Tynjala <[email protected]>
AuthorDate: Thu Sep 19 10:57:49 2024 -0700

    FunctionDefinition: fixed incorrect ConflictingDefinitionProblem when 
there's a method in a language namespace (like public/protected) and a method 
in non-language namespace (like mx_internal)
    
    They shouldn't be considered conflicting because they will have different 
names in generated JS. This is a followup to commit 
97dc7275c398d86bec6186e02e973ce0e49011bc, which added the 
ConflictingDefinitionProblem because generated JS names in 
public/protected/private could potentially conflict with each other. Members in 
non-language namespaces get mangled names that includes the namespace, so there 
is no conflict here.
    
    This fixes an issue in sdk.dependent.tests where mx_internal and protected 
methods were considered to be conflicting. It's one step closer to re-including 
the currently excluded SDKSWCTests class in sdk.dependent.tests.
---
 .../royale/compiler/internal/definitions/FunctionDefinition.java    | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/FunctionDefinition.java
 
b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/FunctionDefinition.java
index f9e41b460..1defdfe32 100644
--- 
a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/FunctionDefinition.java
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/FunctionDefinition.java
@@ -380,6 +380,12 @@ public class FunctionDefinition extends 
ScopedDefinitionBase implements IFunctio
             IDefinition anyDef = 
base.getContainedScope().getPropertyFromDef(project, base, this.getBaseName(), 
new PrivatePredicate(!project.getAllowPrivateNameConflicts()), false);
             if (anyDef != null) // there might be a variable or a function in 
a different namespace (private vs protected)
             {
+                if (anyDef.getNamespaceReference().isLanguageNamespace() && 
!getNamespaceReference().isLanguageNamespace()) {
+                    return null;
+                }
+                if (!anyDef.getNamespaceReference().isLanguageNamespace() && 
getNamespaceReference().isLanguageNamespace()) {
+                    return null;
+                }
                 if (this instanceof IAccessorDefinition) {
                     //cover cases between getter and setter
                     boolean otherIsGetter = anyDef instanceof 
IGetterDefinition;

Reply via email to