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

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

Issue 10716005: Fixes the scope of case labels so that duplicate case labels are properly detected (Closed) Base URL: https://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
diff --git a/compiler/java/com/google/dart/compiler/resolver/Scope.java b/compiler/java/com/google/dart/compiler/resolver/Scope.java
index 84d4af8011bf7dd2722e5b79243df8a2e7cffa82..344ca256fdb24e66b817265e4fe20cefdb0de625 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Scope.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Scope.java
@@ -88,10 +88,21 @@ public class Scope {
parent.findLabel(targetName, innermostFunction);
}
+ public boolean hasLocalLabel(String labelName) {
+ if (labels != null) {
+ for (LabelElement label : labels) {
+ if (label.getName().equals(labelName)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
public Map<String, Element> getElements() {
return elements;
}
-
+
/**
* @return <code>true</code> if local variable with given name is declared in the lexical context
* of {@link DartBlock}, but corresponding {@link DartVariableStatement} is not visited
@@ -100,14 +111,14 @@ public class Scope {
public boolean isDeclaredButNotReachedVariable(String name) {
return declaredButNotReachedVariables.contains(name);
}
-
+
/**
* @see #isDeclaredButNotReachedVariable(String)
*/
public void addDeclaredButNotReachedVariable(String name) {
declaredButNotReachedVariables.add(name);
}
-
+
/**
* @see #isDeclaredButNotReachedVariable(String)
*/

Powered by Google App Engine
This is Rietveld 408576698