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

Unified Diff: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java

Issue 10536143: Detect continue inside of case statement with no label (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed problem with function definitions inside case stmts 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
« no previous file with comments | « compiler/java/com/google/dart/compiler/parser/ParserErrorCode.java ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
index 2bdfe045827bb0f266daafb4aa1facbddd33a217..9b00be2ee63f0e3a67a37e5c3965cdd522c174f1 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
@@ -562,6 +562,28 @@ public class SyntaxTest extends AbstractParserTest {
ParserErrorCode.BREAK_OUTSIDE_OF_LOOP, 9, 35);
}
+ public void testContinueNoLabelInsideCase() throws Exception {
+ parseUnit("phony_lone_super_expression1.dart",
+ Joiner.on("\n").join(
+ "class A {",
+ " method() {",
+ " switch(1) {",
+ " case 1: continue;", // error
+ " }",
+ " while (1) {",
+ " switch(1) {",
+ " case 1: continue;", // ok, refers to the while loop.
+ " }",
+ " }",
+ " L: switch(1) {",
+ " case 1: var result = f() { continue L; };", // bad
+ " }",
+ " }",
+ "}"),
+ ParserErrorCode.CONTINUE_IN_CASE_MUST_HAVE_LABEL, 4, 23,
+ ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, 12, 42);
+ }
+
public void testBogusEscapedNewline() throws Exception {
parseUnit("phony_bogus_escaped_newline.dart",
Joiner.on("\n").join(
« no previous file with comments | « compiler/java/com/google/dart/compiler/parser/ParserErrorCode.java ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698