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

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

Issue 10725002: Validate the target of break and continue statments from within a switch (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/Elements.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Elements.java b/compiler/java/com/google/dart/compiler/resolver/Elements.java
index 871634aab879fbe1427802486635680b0bc880d6..35e0cbff4946dc4e1751632bba8bbbcc782a1bf2 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Elements.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Elements.java
@@ -32,6 +32,7 @@ import com.google.dart.compiler.ast.LibraryUnit;
import com.google.dart.compiler.ast.Modifiers;
import com.google.dart.compiler.common.SourceInfo;
import com.google.dart.compiler.parser.Token;
+import com.google.dart.compiler.resolver.LabelElement.LabeledStatementType;
import com.google.dart.compiler.type.InterfaceType;
import com.google.dart.compiler.type.Type;
import com.google.dart.compiler.type.TypeVariable;
@@ -78,8 +79,22 @@ public class Elements {
((ClassElementImplementation) classElement).addInterface(type);
}
- static LabelElement labelElement(DartLabel node, String name, MethodElement enclosingFunction) {
- return new LabelElementImplementation(node, name, enclosingFunction);
+ static LabelElement statementLabelElement(DartLabel node, String name,
+ MethodElement enclosingFunction) {
+ return new LabelElementImplementation(node, name, enclosingFunction,
+ LabeledStatementType.STATEMENT);
+ }
+
+ static LabelElement switchMemberLabelElement(DartLabel node, String name,
+ MethodElement enclosingFunction) {
+ return new LabelElementImplementation(node, name, enclosingFunction,
+ LabeledStatementType.SWITCH_MEMBER_STATEMENT);
+ }
+
+ static LabelElement switchLabelElement(DartLabel node, String name,
+ MethodElement enclosingFunction) {
+ return new LabelElementImplementation(node, name, enclosingFunction,
+ LabeledStatementType.SWITCH_STATEMENT);
}
public static LibraryElement libraryElement(LibraryUnit libraryUnit) {

Powered by Google App Engine
This is Rietveld 408576698