| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 |
| 7 var global = 0; |
| 8 |
| 9 bar() { |
| 10 global = 1; |
| 11 } |
| 12 |
| 13 baz() { |
| 14 global = 2; |
| 15 } |
| 16 |
| 17 return_const(b) { |
| 18 if (b) { |
| 19 bar(); |
| 20 return 1; |
| 21 } else { |
| 22 baz(); |
| 23 return 1; |
| 24 } |
| 25 } |
| 26 |
| 27 return_var(b, x) { |
| 28 if (b) { |
| 29 bar(); |
| 30 return x; |
| 31 } else { |
| 32 baz(); |
| 33 return x; |
| 34 } |
| 35 } |
| 36 |
| 37 main() { |
| 38 return_const(true); |
| 39 Expect.equals(1, global); |
| 40 return_const(false); |
| 41 Expect.equals(2, global); |
| 42 |
| 43 Expect.equals(4, return_var(true, 4)); |
| 44 Expect.equals(1, global); |
| 45 Expect.equals(5, return_var(false, 5)); |
| 46 Expect.equals(2, global); |
| 47 } |
| OLD | NEW |