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 a47853b ClassDefinition: fixed case where problems could contain more
than one of the same DuplicateSkinStateProblem
a47853b is described below
commit a47853b5b51c83bbcd0e57860896017bd6e1e503
Author: Josh Tynjala <[email protected]>
AuthorDate: Thu Sep 5 14:07:44 2019 -0700
ClassDefinition: fixed case where problems could contain more than one of
the same DuplicateSkinStateProblem
---
.../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()]);
}