| 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 // Check that we hoist instructions in a loop condition, even if that |
| 6 // condition involves control flow. |
| 7 |
| 8 import 'package:expect/expect.dart'; |
| 9 |
| 10 import 'compiler_helper.dart'; |
| 11 |
| 12 const String TEST = ''' |
| 13 var a = [1]; |
| 14 |
| 15 main() { |
| 16 int count = int.parse('42') == 42 ? 42 : null; |
| 17 for (int i = 0; i < count && i < a[0]; i++) { |
| 18 print(i); |
| 19 } |
| 20 a.removeLast(); |
| 21 // Ensure we don't try to generate a bailout method based on a check |
| 22 // of [count]. |
| 23 count.removeLast(); |
| 24 } |
| 25 '''; |
| 26 |
| 27 main() { |
| 28 compileAndMatch( |
| 29 TEST, 'main', new RegExp("if \\(count == null\\)(.|\\n)*while")); |
| 30 } |
| OLD | NEW |