OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library test.instance_members; |
| 6 |
| 7 import 'dart:mirrors'; |
| 8 import 'package:expect/expect.dart'; |
| 9 |
| 10 import 'declarations_model.dart' as declarations_model; |
| 11 |
| 12 selectKeys(map, predicate) { |
| 13 return map.keys.where((key) => predicate(map[key])); |
| 14 } |
| 15 |
| 16 main() { |
| 17 ClassMirror cm = reflectClass(declarations_model.Class); |
| 18 |
| 19 Expect.setEquals( |
| 20 [#+, |
| 21 #instanceVariable, |
| 22 const Symbol('instanceVariable='), |
| 23 #instanceGetter, |
| 24 const Symbol('instanceSetter='), |
| 25 #instanceMethod, |
| 26 #-, |
| 27 #inheritedInstanceVariable, |
| 28 const Symbol('inheritedInstanceVariable='), |
| 29 #inheritedInstanceGetter, |
| 30 const Symbol('inheritedInstanceSetter='), |
| 31 #inheritedInstanceMethod, |
| 32 #*, |
| 33 #mixinInstanceVariable, |
| 34 const Symbol('mixinInstanceVariable='), |
| 35 #mixinInstanceGetter, |
| 36 const Symbol('mixinInstanceSetter='), |
| 37 #mixinInstanceMethod, |
| 38 #hashCode, |
| 39 #runtimeType, |
| 40 #==, |
| 41 #noSuchMethod, |
| 42 #toString], |
| 43 selectKeys(cm.instanceMembers, (dm) => !dm.isPrivate)); |
| 44 // Filter out private to avoid implementation-specific members of Object. |
| 45 |
| 46 Expect.setEquals( |
| 47 [#instanceVariable, |
| 48 const Symbol('instanceVariable='), |
| 49 #inheritedInstanceVariable, |
| 50 const Symbol('inheritedInstanceVariable='), |
| 51 #mixinInstanceVariable, |
| 52 const Symbol('mixinInstanceVariable=')], |
| 53 selectKeys(cm.instanceMembers, (dm) => !dm.isPrivate && dm.isSynthetic)); |
| 54 } |
OLD | NEW |