| 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 var foo; |
| 6 bar() => foo(3, 99); |
| 7 gee(f) => foo(fun: f); |
| 8 |
| 9 get foo2() => foo; |
| 10 bar2() => foo2(3, 99); |
| 11 gee2(f) => foo2(fun: f); |
| 12 |
| 13 globalTest() { |
| 14 foo = () => 499; |
| 15 Expect.equals(499, foo()); |
| 16 foo = (x, y) => x + y; |
| 17 Expect.equals(102, bar()); |
| 18 foo = ([fun = null]) => fun(41); |
| 19 Expect.equals(42, gee((x) => x + 1)); |
| 20 |
| 21 foo = () => 499; |
| 22 Expect.equals(499, foo2()); |
| 23 foo = (x, y) => x + y; |
| 24 Expect.equals(102, bar2()); |
| 25 foo = ([fun = null]) => fun(41); |
| 26 Expect.equals(42, gee2((x) => x + 1)); |
| 27 } |
| 28 |
| 29 class A { |
| 30 static var foo; |
| 31 static bar() => foo(3, 99); |
| 32 static gee(f) => foo(fun: f); |
| 33 |
| 34 static get foo2() => foo; |
| 35 static bar2() => foo2(3, 99); |
| 36 static gee2(f) => foo2(fun: f); |
| 37 } |
| 38 |
| 39 staticTest() { |
| 40 A.foo = () => 499; |
| 41 Expect.equals(499, A.foo()); |
| 42 A.foo = (x, y) => x + y; |
| 43 Expect.equals(102, A.bar()); |
| 44 A.foo = ([fun = null]) => fun(41); |
| 45 Expect.equals(42, A.gee((x) => x + 1)); |
| 46 |
| 47 A.foo = () => 499; |
| 48 Expect.equals(499, A.foo2()); |
| 49 A.foo = (x, y) => x + y; |
| 50 Expect.equals(102, A.bar2()); |
| 51 A.foo = ([fun = null]) => fun(41); |
| 52 Expect.equals(42, A.gee2((x) => x + 1)); |
| 53 } |
| 54 |
| 55 main() { |
| 56 globalTest(); |
| 57 staticTest(); |
| 58 } |
| OLD | NEW |