Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Resolver.java

Issue 10910176: Issue 5055. Visit field getter/setter only once. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/resolver/Resolver.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Resolver.java b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
index d11f50f53a34523c3cddf576209641d3db5d0a60..a2f47c0daf44bc1d44749d3667093dfca2a9cf42 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -192,6 +192,7 @@ public class Resolver {
private Set<LabelElement> referencedLabels = Sets.newHashSet();
private Set<LabelElement> labelsInScopes = Sets.newHashSet();
private Set<FieldElement> finalsNeedingInitializing = Sets.newHashSet();
+ private Set<FieldElement> resolvedFields = Sets.newHashSet();
@VisibleForTesting
public ResolveElementsVisitor(ResolutionContext context,
@@ -735,12 +736,16 @@ public class Resolver {
}
// If field is an accessor, both getter and setter need to be visited (if present).
+ // We check for duplicates because top-level fields are visited twice - for each accessor.
FieldNodeElement field = node.getElement();
- if (field.getGetter() != null) {
- resolve(field.getGetter().getNode());
- }
- if (field.getSetter() != null) {
- resolve(field.getSetter().getNode());
+ if (!resolvedFields.contains(field)) {
+ resolvedFields.add(field);
+ if (field.getGetter() != null) {
+ resolve(field.getGetter().getNode());
+ }
+ if (field.getSetter() != null) {
+ resolve(field.getSetter().getNode());
+ }
}
return null;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698