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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Resolver.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/Resolver.java
===================================================================
--- compiler/java/com/google/dart/compiler/resolver/Resolver.java (revision 8465)
+++ compiler/java/com/google/dart/compiler/resolver/Resolver.java (working copy)
@@ -181,7 +181,6 @@
private boolean inInitializer;
private MethodElement innermostFunction;
private ResolutionContext context;
- private LabelElement currentLabel;
private Set<LabelElement> referencedLabels = Sets.newHashSet();
private Set<LabelElement> labelsInScopes = Sets.newHashSet();
private Set<FieldElement> finalsNeedingInitializing = Sets.newHashSet();
@@ -744,8 +743,7 @@
@Override
public Element visitLabel(DartLabel x) {
- LabelElement previousLabel = currentLabel;
- currentLabel = Elements.labelElement(x, x.getName(), innermostFunction);
+ LabelElement currentLabel = Elements.labelElement(x, x.getName(), innermostFunction);
recordElement(x.getLabel(), currentLabel);
recordElement(x, currentLabel);
x.visitChildren(this);
@@ -756,7 +754,6 @@
// TODO(zundel): warning, not type error.
// topLevelContext.typeError(x, DartCompilerErrorCode.UNREFERENCED_LABEL, x.getName());
}
- currentLabel = previousLabel;
return null;
}
@@ -872,12 +869,12 @@
}
private void addLabelToStatement(DartStatement x) {
- if (currentLabel != null) {
- DartNode parent = x.getParent();
- if (parent instanceof DartLabel) {
- getContext().getScope().setLabel(currentLabel);
- labelsInScopes.add(currentLabel);
- }
+ DartNode parent = x.getParent();
+ while (parent instanceof DartLabel) {
+ LabelElement currentLabel = ((DartLabel) parent).getElement();
+ getContext().getScope().addLabel(currentLabel);
+ labelsInScopes.add(currentLabel);
+ parent = parent.getParent();
}
}

Powered by Google App Engine
This is Rietveld 408576698