You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2020/03/17 06:39:48 UTC

[royale-compiler] branch develop updated: Take 2 on avoiding errors with implicit 'Bindable' IEventDispatcher methods - it can be derived from a [Bindable] ancestor as well. Same as Flex legacy code.

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

gregdove 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 711aee2  Take 2 on avoiding errors with implicit 'Bindable' IEventDispatcher methods - it can be derived from a [Bindable] ancestor as well. Same as Flex legacy code.
711aee2 is described below

commit 711aee28e3ebee3fa9189ec6fbeaa0e951edf132
Author: greg-dove <gr...@gmail.com>
AuthorDate: Tue Mar 17 19:39:13 2020 +1300

    Take 2 on avoiding errors with implicit 'Bindable' IEventDispatcher methods - it can be derived from a [Bindable] ancestor as well. Same as Flex legacy code.
---
 .../internal/semantics/MethodBodySemanticChecker.java        | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java b/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java
index 5640c8d..af86af1 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java
@@ -873,8 +873,18 @@ public class MethodBodySemanticChecker
         if (def == null) {
             IDefinition defCheck = SemanticUtils.getDefinitionOfUnderlyingType(iNode,true, project);
             if (defCheck instanceof IClassDefinition) {
-                //if we are adding the bindable IEventDispatcher implementation, then we should allow those IEventDispatcher methods
+                //if we have the bindable IEventDispatcher implementation either at this level or via ancestry, then we should allow those IEventDispatcher methods
+                boolean assumeBindableIEventDispatcher = false;
+                IClassDefinition.IClassIterator classIterator = ((IClassDefinition) defCheck).classIterator(project, true);
+                while (classIterator.hasNext())
+                {
+                    defCheck = classIterator.next();
                     if (((IClassDefinition)defCheck).needsEventDispatcher(project)) {
+                        assumeBindableIEventDispatcher = true;
+                        break;
+                    }
+                }
+                if (assumeBindableIEventDispatcher) {
                     IInterfaceDefinition iEventDispatcher =  iEventDispatcher();
                     IDefinitionSet bindingMethodCheck = iEventDispatcher.getContainedScope().getLocalDefinitionSetByName( method_binding.getName().getBaseName());
                     if (bindingMethodCheck!=null && bindingMethodCheck.getSize() == 1) {