| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 var counter = 0; |
| 7 var global = 0; | 8 var global = 0; |
| 8 | 9 |
| 9 bar() { | 10 test() { |
| 10 global += 1; | 11 ++counter; |
| 11 } | 12 return counter <= 2; |
| 12 baz() { | |
| 13 global += 100; | |
| 14 } | 13 } |
| 15 | 14 |
| 16 foo(b) { | 15 first() { |
| 17 var old_backend_was_used; | 16 global = global + 1; |
| 18 if (b ? false : true) { | 17 } |
| 19 bar(); | 18 second() { |
| 20 bar(); | 19 global = global * 2; |
| 21 } else { | 20 } |
| 22 baz(); | 21 |
| 23 baz(); | 22 foo() { |
| 23 while (test()) { |
| 24 first(); |
| 25 second(); |
| 24 } | 26 } |
| 25 } | 27 } |
| 26 | 28 |
| 27 main() { | 29 main() { |
| 28 foo(true); | 30 foo(); |
| 29 Expect.equals(200, global); | 31 Expect.equals(6, global); |
| 30 | |
| 31 foo(false); | |
| 32 Expect.equals(202, global); | |
| 33 } | 32 } |
| OLD | NEW |