| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2016, 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 foo() { |
| 6 try { |
| 7 return; |
| 8 } finally { |
| 9 print("Hello from finally block!"); |
| 10 } |
| 11 } |
| 12 |
| 13 bar() async { |
| 14 await for (var x in []) { |
| 15 yield x; |
| 16 yield* x; |
| 17 } |
| 18 } |
| 19 |
| 20 main() { |
| 21 do { |
| 22 print("Hello from do-while!"); |
| 23 } while(false); |
| 24 do var x = print("Hello from do-while!"); while(false); |
| 25 |
| 26 for (String s in ["Hello from for-in!"]) { |
| 27 print(s); |
| 28 } |
| 29 for (String s in ["Hello from for-in without block!"]) |
| 30 print(s); |
| 31 var s; |
| 32 for (s in ["Hello from for-in without decl!"]) { |
| 33 print(s); |
| 34 } |
| 35 for (s in ["Hello from for-in without decl and block!"]) |
| 36 print(s); |
| 37 a: b: c: print("Hello from labeled statement!"); |
| 38 try { |
| 39 try { |
| 40 throw "Hello from rethrow!"; |
| 41 } catch (e) { |
| 42 rethrow; |
| 43 } |
| 44 } catch (e) { |
| 45 print(e); |
| 46 } |
| 47 foo(); |
| 48 bool done = false; |
| 49 while (!done) { |
| 50 done = true; |
| 51 print("Hello from while!"); |
| 52 } |
| 53 ; // Testing empty statement. |
| 54 assert(true); |
| 55 assert(true, "Hello from assert!"); |
| 56 try { |
| 57 assert(false, "Hello from assert!"); |
| 58 } catch (e) { |
| 59 print(e); |
| 60 } |
| 61 switch (1) { |
| 62 case 1: |
| 63 case 2: |
| 64 print("Hello from switch case!"); |
| 65 break; |
| 66 default: |
| 67 break; |
| 68 } |
| 69 switch (4) { |
| 70 L2: case 2: |
| 71 print("Hello from case 2!"); |
| 72 break; |
| 73 L1: case 1: |
| 74 print("Hello from case 1!"); |
| 75 continue L2; |
| 76 L0: case 0: |
| 77 print("Hello from case 0!"); |
| 78 continue L1; |
| 79 case 4: |
| 80 print("Hello from case 4!"); |
| 81 continue LD; |
| 82 LD: default: |
| 83 continue L0; |
| 84 } |
| 85 switch (4) { |
| 86 L0: case 1: |
| 87 print("Hello from next case 1"); |
| 88 break; |
| 89 default: |
| 90 continue L0; |
| 91 } |
| 92 int i = 0; |
| 93 do { |
| 94 print("Hello from do-while!"); |
| 95 if (++i < 3) continue; |
| 96 break; |
| 97 } while (true); |
| 98 i = 0; |
| 99 OUTER: while (true) { |
| 100 print("Hello from while!"); |
| 101 if (++i < 3) continue OUTER; |
| 102 break OUTER; |
| 103 } |
| 104 } |
| OLD | NEW |