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

Side by Side Diff: tests/language/label_test.dart

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
Brian Wilkerson 2012/06/08 18:49:05 nit: copyright year
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test program to test check that we can parse labels. 4 // Dart test program to test check that we can parse labels.
5 5
6 6
7 class Helper { 7 class Helper {
8 8
9 static int ticks; 9 static int ticks;
10 10
11 // Helper function to prevent endless loops in case labels or 11 // Helper function to prevent endless loops in case labels or
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } finally { 214 } finally {
215 } 215 }
216 break; 216 break;
217 } 217 }
218 Expect.equals(111, i); 218 Expect.equals(111, i);
219 219
220 return i; 220 return i;
221 } 221 }
222 222
223 static test11() { 223 static test11() {
224 // Kind of odd, but is valid and shouldn't be flagged as useless either. 224 while (true) {
Brian Wilkerson 2012/06/08 18:49:05 Looking at the spec, I don't see where the origina
zundel 2012/06/08 20:15:08 You are right. I had coded it incorrectly at first
225 L: break L; 225 // Kind of odd, but is valid and shouldn't be flagged as useless either.
226 L: break L;
227 }
226 return 111; 228 return 111;
227 } 229 }
228 230
229 static test12() { 231 static test12() {
230 int i = 111; 232 int i = 111;
231 233
232 // label the inner block on compound stmts 234 // label the inner block on compound stmts
233 if (true) L: { 235 if (true) L: {
234 while (doAgain()) { 236 while (doAgain()) {
235 break L; 237 break L;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 Expect.equals(111, Helper.test9()); 309 Expect.equals(111, Helper.test9());
308 Expect.equals(111, Helper.test10()); 310 Expect.equals(111, Helper.test10());
309 Expect.equals(111, Helper.test11()); 311 Expect.equals(111, Helper.test11());
310 Expect.equals(111, Helper.test12()); 312 Expect.equals(111, Helper.test12());
311 } 313 }
312 } 314 }
313 315
314 main() { 316 main() {
315 LabelTest.testMain(); 317 LabelTest.testMain();
316 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698