You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by pi...@apache.org on 2019/09/10 04:47:20 UTC
[royale-compiler] 02/02: ClassDefinition: fixed case where problems
could contain more than one of the same DuplicateSkinStateProblem
This is an automated email from the ASF dual-hosted git repository.
piotrz pushed a commit to branch release/0.9.6
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 31c0a5a689ebcce482ef9360f042a4ab9b189c13
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Thu Sep 5 14:07:44 2019 -0700
ClassDefinition: fixed case where problems could contain more than one of the same DuplicateSkinStateProblem
(cherry picked from commit a47853b5b51c83bbcd0e57860896017bd6e1e503)
---
.../internal/definitions/ClassDefinition.java | 23 ++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinition.java b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinition.java
index 9e3f63f..85a6900 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinition.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinition.java
@@ -768,20 +768,27 @@ public class ClassDefinition extends ClassDefinitionBase implements IClassDefini
{
Set<String> states = new HashSet<String>();
- // Iterate over this class and its superclasses.
- for (IClassDefinition c : classIterable(project, true))
+ // Iterate over the superclasses first, but don't worry about duplicates
+ // yet. The superclasses will find their own duplicates!
+ for (IClassDefinition c : classIterable(project, false))
{
for (String state : c.getSkinStates(problems))
{
- if (states.contains(state))
- {
- ICompilerProblem problem = new DuplicateSkinStateProblem(c, state);
- problems.add(problem);
- }
-
states.add(state);
}
}
+ // Then, add the states from this class and check for duplicates that
+ // specifically come from this class
+ for (String state : getSkinStates(problems))
+ {
+ if (states.contains(state))
+ {
+ ICompilerProblem problem = new DuplicateSkinStateProblem(this, state);
+ problems.add(problem);
+ }
+
+ states.add(state);
+ }
return states.toArray(new String[states.size()]);
}