You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/11/29 20:35:04 UTC

[royale-compiler] branch develop updated: handle subclasses of factory classes as well

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

aharui 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 ff9f7b3  handle subclasses of factory classes as well
ff9f7b3 is described below

commit ff9f7b369c16874da8317250bc54be05f3fafe6b
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Nov 29 12:24:46 2018 -0800

    handle subclasses of factory classes as well
---
 .../apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java
index 557dbf2..07291f8 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java
@@ -137,6 +137,7 @@ public class MXMLTreeBuilder
         this.compilationUnit = compilationUnit;
         this.fileSpecGetter = fileSpecGetter;
         project = compilationUnit.getProject();
+        factoryDef = (ITypeDefinition) project.resolveQNameToDefinition(project.getFactoryInterface());
         projectScope = (ASProjectScope)project.getScope();
         workspace = (Workspace)project.getWorkspace();
         this.qname = qname;
@@ -154,6 +155,8 @@ public class MXMLTreeBuilder
     private final IFileSpecificationGetter fileSpecGetter;
 
     private final RoyaleProject project;
+    
+    private final ITypeDefinition factoryDef;
 
     private final ASProjectScope projectScope;
 
@@ -664,7 +667,7 @@ public class MXMLTreeBuilder
         String typeName = (type != null) ? type.getQualifiedName() : "";
 
         // For a property of type IFactory, create an MXMLFactoryNode.
-        if (typeName.equals(project.getFactoryInterface()))
+        if (type != null && type.isInstanceOf(factoryDef, project))
         {
             if (flags.contains(TextParsingFlags.ALLOW_BINDING))
             {
@@ -791,7 +794,7 @@ public class MXMLTreeBuilder
 
         return instanceNode;
     }
-
+    
     /**
      * Reads an external file specified by a <code>source</code> attribute.
      *