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 var a = 42; |
| 6 |
| 7 foo1() { |
| 8 var i = 0; |
| 9 var saved; |
| 10 do { |
| 11 saved = i; |
| 12 i = a; |
| 13 } while (i == saved); |
| 14 Expect.equals(0, saved); |
| 15 Expect.equals(42, i); |
| 16 } |
| 17 |
| 18 foo2() { |
| 19 var i = 0; |
| 20 var saved; |
| 21 do { |
| 22 saved = i; |
| 23 i = a; |
| 24 } while (i != saved); |
| 25 Expect.equals(42, saved); |
| 26 Expect.equals(42, i); |
| 27 } |
| 28 |
| 29 foo3() { |
| 30 var i = 0; |
| 31 var saved; |
| 32 do { |
| 33 saved = i; |
| 34 i = a; |
| 35 if (i == saved) continue; |
| 36 } while (i != saved); |
| 37 Expect.equals(42, saved); |
| 38 Expect.equals(42, i); |
| 39 } |
| 40 |
| 41 main() { |
| 42 foo1(); |
| 43 foo2(); |
| 44 foo3(); |
| 45 } |
OLD | NEW |