| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, 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 // Test to make sure the do/while loop exit condition is generated. |
| 6 |
| 7 var global; |
| 8 |
| 9 class A { |
| 10 var array; |
| 11 |
| 12 initArray() { |
| 13 if (global[0] == null) { |
| 14 return [2]; |
| 15 } else { |
| 16 var map = new Map(); |
| 17 map[0] = 2; |
| 18 return map; |
| 19 } |
| 20 } |
| 21 |
| 22 bar() { |
| 23 array = initArray(); |
| 24 var element; |
| 25 do { |
| 26 element = array[0]; // bailout here |
| 27 if (element is Map) continue; |
| 28 if (element == null) break; |
| 29 } while (element != 2); |
| 30 return global[0]; // bailout here |
| 31 } |
| 32 } |
| 33 |
| 34 |
| 35 void main() { |
| 36 global = [2]; |
| 37 for (int i = 0; i < 2; i++) { |
| 38 Expect.equals(2, new A().bar()); |
| 39 } |
| 40 |
| 41 global = new Map(); |
| 42 global[0] = 2; |
| 43 for (int i = 0; i < 2; i++) { |
| 44 Expect.equals(2, new A().bar()); |
| 45 } |
| 46 } |
| OLD | NEW |