| OLD | NEW | 
|---|
|  | (Empty) | 
| 1 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file |  | 
| 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. |  | 
| 4 |  | 
| 5 // A break label must be declared where it's used. |  | 
| 6 undeclaredBreakLabel1() { |  | 
| 7   foo: { break bar; break foo; }  /// 01: compile-time error |  | 
| 8 } |  | 
| 9 |  | 
| 10 undeclaredBreakLabel2() { |  | 
| 11   foo: while (true) { break bar; break foo; }  /// 02: compile-time error |  | 
| 12 } |  | 
| 13 |  | 
| 14 // An unlabeled break must be inside a loop or switch. |  | 
| 15 noBreakTarget() { |  | 
| 16   foo: if (true) { break; break foo; }  /// 03: compile-time error |  | 
| 17 } |  | 
| 18 |  | 
| 19 // A continue label must be declared where it's used. |  | 
| 20 undeclaredContinueLabel() { |  | 
| 21   foo: for (;;) { continue bar; break foo; }  /// 04: compile-time error |  | 
| 22 } |  | 
| 23 |  | 
| 24 // An unlabeled continue must be inside a loop. |  | 
| 25 noContinueTarget() { |  | 
| 26   foo: if (true) continue; else break foo;  /// 05: compile-time error |  | 
| 27 } |  | 
| 28 |  | 
| 29 // A continue label must point to a continue-able statement. |  | 
| 30 wrongContinueLabel() { |  | 
| 31   foo: if (true) continue foo;  /// 06: compile-time error |  | 
| 32 } |  | 
| 33 |  | 
| 34 // Labels are not captured by closures. |  | 
| 35 noncaptureLabel() { |  | 
| 36   foo: {                    /// 07: compile-time error |  | 
| 37     (() { break foo; })();  /// 07: continued |  | 
| 38     break foo;              /// 07: continued |  | 
| 39   }                         /// 07: continued |  | 
| 40 } |  | 
| 41 |  | 
| 42 // Implicit break targets are not captured by closures. |  | 
| 43 noncaptureBreak() { |  | 
| 44   while(true) (() { break; })();  /// 08: compile-time error |  | 
| 45 } |  | 
| 46 |  | 
| 47 // Implicit continue targets are not captured by closures. |  | 
| 48 noncaptureContinue() { |  | 
| 49   while(true) (() { continue; })();  /// 09: compile-time error |  | 
| 50 } |  | 
| 51 |  | 
| 52 main() { |  | 
| 53   undeclaredBreakLabel1(); |  | 
| 54   undeclaredBreakLabel2(); |  | 
| 55   noBreakTarget(); |  | 
| 56   undeclaredContinueLabel(); |  | 
| 57   noContinueTarget(); |  | 
| 58   wrongContinueLabel(); |  | 
| 59   noncaptureLabel(); |  | 
| 60   noncaptureBreak(); |  | 
| 61   noncaptureContinue(); |  | 
| 62 } |  | 
| OLD | NEW | 
|---|