| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012, 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 final x = foo(); |
| 6 final y = y2(y3); |
| 7 final y2 = incrementCreator(); |
| 8 final y3 = fib(5); |
| 9 |
| 10 foo() => 499; |
| 11 |
| 12 incrementCreator() => (x) => x + 1; |
| 13 fib(x) { |
| 14 if (x < 2) return x; |
| 15 return fib(x - 1) + fib(x - 2); |
| 16 } |
| 17 |
| 18 var count = 0; |
| 19 sideEffect() => count++; |
| 20 |
| 21 final t = sideEffect(); |
| 22 final t2 = sideEffect(); |
| 23 |
| 24 class A { |
| 25 static final a = toto(); |
| 26 static final b = b2(b3); |
| 27 static final b2 = decrementCreator(); |
| 28 static final b3 = fact(5); |
| 29 |
| 30 static toto() => 666; |
| 31 |
| 32 static decrementCreator() => (x) => x - 1; |
| 33 static fact(x) { |
| 34 if (x <= 1) return x; |
| 35 return x * fact(x - 1); |
| 36 } |
| 37 } |
| 38 |
| 39 main() { |
| 40 Expect.equals(499, x); |
| 41 Expect.equals(6, y); |
| 42 Expect.equals(666, A.a); |
| 43 Expect.equals(119, A.b); |
| 44 Expect.equals(0, t); |
| 45 t2 = 499; |
| 46 Expect.equals(499, t2); |
| 47 Expect.equals(1, count); |
| 48 } |
| OLD | NEW |