| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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"; | |
| 6 | |
| 7 topLevelMethod() => 't'; | 5 topLevelMethod() => 't'; |
| 8 | 6 |
| 9 const topLevelFieldForTopLevelMethod = topLevelMethod; | 7 const topLevelFieldForTopLevelMethod = topLevelMethod; |
| 10 const topLevelFieldForStaticMethod = A.staticMethod; | 8 const topLevelFieldForStaticMethod = A.staticMethod; |
| 11 | 9 |
| 12 class A { | 10 class A { |
| 13 final Function closure; | 11 final Function closure; |
| 14 const A(this.closure); | 12 const A(this.closure); |
| 15 const A.defaultTopLevel([this.closure = topLevelMethod]); | 13 const A.defaultTopLevel([this.closure = topLevelMethod]); |
| 16 const A.defaultStatic([this.closure = staticMethod]); | 14 const A.defaultStatic([this.closure = staticMethod]); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 33 Expect.equals('s', (new A.defaultStatic2()).run()); | 31 Expect.equals('s', (new A.defaultStatic2()).run()); |
| 34 Expect.equals('t', topLevelFieldForTopLevelMethod()); | 32 Expect.equals('t', topLevelFieldForTopLevelMethod()); |
| 35 Expect.equals('s', topLevelFieldForStaticMethod()); | 33 Expect.equals('s', topLevelFieldForStaticMethod()); |
| 36 Expect.equals('t', A.staticFieldForTopLevelMethod()); | 34 Expect.equals('t', A.staticFieldForTopLevelMethod()); |
| 37 Expect.equals('s', A.staticFieldForStaticMethod()); | 35 Expect.equals('s', A.staticFieldForStaticMethod()); |
| 38 | 36 |
| 39 var map = const {'t': topLevelMethod, 's': A.staticMethod }; | 37 var map = const {'t': topLevelMethod, 's': A.staticMethod }; |
| 40 Expect.equals('t', map['t']()); | 38 Expect.equals('t', map['t']()); |
| 41 Expect.equals('s', map['s']()); | 39 Expect.equals('s', map['s']()); |
| 42 } | 40 } |
| OLD | NEW |