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