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/03/30 15:32:50 UTC

[royale-compiler] branch develop updated: fix caching for instanceOf

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 3b4d660  fix caching for instanceOf
3b4d660 is described below

commit 3b4d6608e99e8684869d66f925883c16752f337e
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Mar 30 08:32:39 2018 -0700

    fix caching for instanceOf
---
 .../compiler/internal/definitions/ClassDefinitionBase.java  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java
index de8cfe1..80530bd 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java
@@ -415,6 +415,7 @@ public abstract class ClassDefinitionBase extends TypeDefinitionBase implements
     }
 
     private ArrayList<IDefinition> baseDefinitions = null;
+    private ArrayList<IDefinition> implDefinitions = null;
     
     @Override
     public boolean isInstanceOf(final ITypeDefinition type, ICompilerProject project)
@@ -439,12 +440,13 @@ public abstract class ClassDefinitionBase extends TypeDefinitionBase implements
 	                baseDefinitions.add(cls);
 	            }
         	}
+            return baseDefinitions.contains(type);
         }
         else if (type instanceof IInterfaceDefinition)
         {
-        	if (baseDefinitions == null)
+        	if (implDefinitions == null)
         	{
-        		baseDefinitions = new ArrayList<IDefinition>();
+        		implDefinitions = new ArrayList<IDefinition>();
         		
 	            // We're trying to determine whether this class
 	            // implements a specified interface ('type').
@@ -454,12 +456,13 @@ public abstract class ClassDefinitionBase extends TypeDefinitionBase implements
 	            while (iter.hasNext())
 	            {
 	                IInterfaceDefinition intf = iter.next();
-	                baseDefinitions.add(intf);
+	                implDefinitions.add(intf);
 	            }
-        	}
+	        }
+            return implDefinitions.contains(type);
         }
 
-    	return baseDefinitions.contains(type);
+    	return false;
     }
 
     @Override

-- 
To stop receiving notification emails like this one, please contact
aharui@apache.org.