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 "dart:mirrors" show reflect; | 5 import "dart:mirrors" show reflect; |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 class GetName { | 8 class GetName { |
9 set flif(_) => "flif="; | 9 set flif(_) => "flif="; |
10 } | 10 } |
11 | 11 |
12 int getName(im) => reflect(new GetName()).delegate(im); | 12 int getName(im) => reflect(new GetName()).delegate(im); |
13 | 13 |
14 class C { | 14 class C { |
15 var im; | 15 var im; |
16 noSuchMethod(im) => this.im = im; | 16 noSuchMethod(im) => this.im = im; |
17 flif() {} | 17 flif() {} |
18 } | 18 } |
19 | 19 |
20 main() { | 20 main() { |
21 var c = new C(); | 21 dynamic c = new C(); |
22 c.flif = 42; | 22 c.flif = 42; |
23 Expect.equals(42, getName(c.im)); | 23 Expect.equals(42, getName(c.im)); |
24 Expect.equals(42, c.im.positionalArguments[0]); | 24 Expect.equals(42, c.im.positionalArguments[0]); |
25 } | 25 } |
OLD | NEW |