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

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

Issue 10534065: In analyzer, catch use of continue and break in inappropriate places (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/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 ea7012e7cf00e7118200f4b1f790af480423ac7d..94270c25eef9d29c6e2eb1c5a12aa33770855e8b 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
@@ -531,4 +531,22 @@ public class SyntaxTest extends AbstractParserTest {
ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 13, 14,
ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 15, 13);
}
+
+ public void testBreakOutsideLoop() throws Exception {
+ parseUnit("phony_lone_super_expression1.dart",
+ Joiner.on("\n").join(
+ "class A {",
+ " method() {",
+ " while (true) { break; }", // ok
+ " break;", // bad
+ " L: break L;", // ok
+ " while (true) { continue; }", // ok
+ " continue;", // bad
+ " C: continue C;", // bad
Brian Wilkerson 2012/06/08 18:49:05 Perhaps add a nested use, such as L2: while (tr
zundel 2012/06/08 20:15:08 that case should be taken care of by the resolver.
+ " }",
+ "}"),
+ ParserErrorCode.BREAK_OUTSIDE_OF_LOOP, 4, 10,
+ ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, 7, 13,
+ ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, 8, 17);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698