Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |