OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library test.instance_members_unimplemented_interface; | 5 library test.instance_members_unimplemented_interface; |
6 | 6 |
| 7 @MirrorsUsed(targets: "test.instance_members_unimplemented_interface") |
7 import 'dart:mirrors'; | 8 import 'dart:mirrors'; |
8 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
9 | 10 |
10 class I { | 11 class I { |
11 implementMe() {} | 12 implementMe() {} |
12 } | 13 } |
13 abstract class C implements I {} | 14 abstract class C implements I {} |
14 | 15 |
15 selectKeys(map, predicate) { | 16 selectKeys(map, predicate) { |
16 return map.keys.where((key) => predicate(map[key])); | 17 return map.keys.where((key) => predicate(map[key])); |
17 } | 18 } |
18 | 19 |
19 main() { | 20 main() { |
20 ClassMirror cm = reflectClass(C); | 21 ClassMirror cm = reflectClass(C); |
21 | 22 |
22 // N.B.: Does not include #implementMe. | 23 // N.B.: Does not include #implementMe. |
23 Expect.setEquals( | 24 Expect.setEquals( |
24 [#hashCode, | 25 [#hashCode, |
25 #runtimeType, | 26 #runtimeType, |
26 #==, | 27 #==, |
27 #noSuchMethod, | 28 #noSuchMethod, |
28 #toString], | 29 #toString], |
29 selectKeys(cm.instanceMembers, (dm) => !dm.isPrivate)); | 30 selectKeys(cm.instanceMembers, (dm) => !dm.isPrivate)); |
30 // Filter out private to avoid implementation-specific members of Object. | 31 // Filter out private to avoid implementation-specific members of Object. |
31 } | 32 } |
OLD | NEW |