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

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

Issue 10539075: Fix for issue 1335 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
Index: compiler/java/com/google/dart/compiler/resolver/Scope.java
===================================================================
--- compiler/java/com/google/dart/compiler/resolver/Scope.java (revision 8465)
+++ compiler/java/com/google/dart/compiler/resolver/Scope.java (working copy)
@@ -7,7 +7,9 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.dart.compiler.ast.DartIdentifier;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
/**
@@ -18,7 +20,7 @@
private final Map<String, Element> elements = new LinkedHashMap<String, Element>();
private final Scope parent;
private final String name;
- private LabelElement label;
+ private List<LabelElement> labels;
private LibraryElement library;
@VisibleForTesting
@@ -69,9 +71,13 @@
}
public Element findLabel(String targetName, MethodElement innermostFunction) {
- if (label != null && label.getName().equals(targetName)
- && innermostFunction == label.getEnclosingFunction()) {
- return label;
+ if (labels != null) {
+ for (LabelElement label : labels) {
+ if (label.getName().equals(targetName)
+ && innermostFunction == label.getEnclosingFunction()) {
+ return label;
+ }
+ }
}
return parent == null ? null :
parent.findLabel(targetName, innermostFunction);
@@ -81,9 +87,9 @@
return elements;
}
- public Element getLabel() {
- return label;
- }
+// public Element getLabel() {
zundel 2012/06/08 23:13:07 remove me
Brian Wilkerson 2012/06/11 15:06:00 Done
+// return label;
+// }
public String getName() {
return name;
@@ -97,8 +103,11 @@
return elements.size() == 0;
}
- public void setLabel(LabelElement label) {
- this.label = label;
+ public void addLabel(LabelElement label) {
+ if (labels == null) {
+ labels = new ArrayList<LabelElement>();
+ }
+ labels.add(label);
}
@Override

Powered by Google App Engine
This is Rietveld 408576698