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.toplevel_members; | 5 library test.toplevel_members; |
6 | 6 |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
9 | 9 |
10 import 'stringify.dart'; | 10 import 'stringify.dart'; |
11 import 'declarations_model.dart' as declarations_model; | 11 import 'declarations_model.dart' as declarations_model; |
12 | 12 |
13 selectKeys(map, predicate) { | 13 selectKeys(map, predicate) { |
14 return map.keys.where((key) => predicate(map[key])); | 14 return map.keys.where((key) => predicate(map[key])); |
15 } | 15 } |
16 | 16 |
17 main() { | 17 main() { |
18 LibraryMirror lm = | 18 LibraryMirror lm = |
19 currentMirrorSystem().findLibrary(#test.declarations_model); | 19 currentMirrorSystem().findLibrary(#test.declarations_model); |
20 | 20 |
21 Expect.setEquals( | 21 Expect.setEquals( |
22 [#libraryVariable, | 22 [#libraryVariable, |
23 const Symbol('libraryVariable='), | 23 const Symbol('libraryVariable='), |
24 #libraryGetter, | 24 #libraryGetter, |
25 const Symbol('librarySetter='), | 25 const Symbol('librarySetter='), |
26 #libraryMethod, | 26 #libraryMethod, |
27 #_libraryVariable, | 27 MirrorSystem.getSymbol('_libraryVariable', lm), |
28 const Symbol('_libraryVariable='), | 28 MirrorSystem.getSymbol('_libraryVariable=', lm), |
29 #_libraryGetter, | 29 MirrorSystem.getSymbol('_libraryGetter', lm), |
30 const Symbol('_librarySetter='), | 30 MirrorSystem.getSymbol('_librarySetter=', lm), |
31 #_libraryMethod, | 31 MirrorSystem.getSymbol('_libraryMethod', lm), |
32 #Predicate, | 32 #Predicate, |
33 #Superclass, | 33 #Superclass, |
34 #Interface, | 34 #Interface, |
35 #Mixin, | 35 #Mixin, |
36 #_PrivateClass, | 36 #Class, |
| 37 MirrorSystem.getSymbol('_PrivateClass', lm), |
37 #ConcreteClass], | 38 #ConcreteClass], |
38 selectKeys(lm.topLevelMembers, (dm) => true)); | 39 selectKeys(lm.topLevelMembers, (dm) => true)); |
39 | 40 |
40 Expect.setEquals( | 41 Expect.setEquals( |
41 [#libraryVariable, | 42 [#libraryVariable, |
42 const Symbol('libraryVariable='), | 43 const Symbol('libraryVariable='), |
43 #_libraryVariable, | 44 MirrorSystem.getSymbol('_libraryVariable', lm), |
44 const Symbol('_libraryVariable='), | 45 MirrorSystem.getSymbol('_libraryVariable=', lm), |
45 #Predicate, | 46 #Predicate, |
46 #Superclass, | 47 #Superclass, |
47 #Interface, | 48 #Interface, |
48 #Mixin, | 49 #Mixin, |
49 #_PrivateClass, | 50 #Class, |
| 51 MirrorSystem.getSymbol('_PrivateClass', lm), |
50 #ConcreteClass], | 52 #ConcreteClass], |
51 selectKeys(lm.topLevelMembers, (dm) => dm.isSynthetic)); | 53 selectKeys(lm.topLevelMembers, (dm) => dm.isSynthetic)); |
52 } | 54 } |
OLD | NEW |