Chromium Code Reviews| 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.toplevel_members; | |
| 6 | |
| 7 import 'dart:mirrors'; | |
| 8 import 'package:expect/expect.dart'; | |
| 9 | |
| 10 import 'stringify.dart'; | |
| 11 import 'declarations_model.dart' as declarations_model; | |
| 12 | |
| 13 selectKeys(map, predicate) { | |
| 14 return map.keys.where((key) => predicate(map[key])); | |
| 15 } | |
| 16 | |
| 17 main() { | |
| 18 LibraryMirror lm = | |
| 19 currentMirrorSystem().findLibrary(#test.declarations_model).single; | |
| 20 | |
| 21 Expect.setEquals( | |
| 22 [#libraryVariable, | |
| 23 const Symbol('libraryVariable='), | |
| 24 #libraryGetter, | |
| 25 const Symbol('librarySetter='), | |
| 26 #libraryMethod, | |
| 27 #_libraryVariable, | |
| 28 const Symbol('_libraryVariable='), | |
| 29 #_libraryGetter, | |
| 30 const Symbol('_librarySetter='), | |
| 31 #_libraryMethod, | |
| 32 #Predicate, | |
|
rmacnak
2013/10/25 21:58:36
?
gbracha
2013/10/26 18:37:48
So the notion of API for a library is alas hazy.
rmacnak
2013/10/30 18:50:42
I'm thinking this should behave how a prefix would
| |
| 33 #Superclass, | |
| 34 #Interface, | |
| 35 #Mixin, | |
| 36 #_PrivateClass, | |
| 37 #ConcreteClass], | |
| 38 selectKeys(lm.toplevelMembers, (dm) => true); | |
| 39 | |
| 40 Expect.setEquals( | |
| 41 [#libraryVariable, | |
| 42 const Symbol('libraryVariable='), | |
| 43 #_libraryVariable, | |
| 44 const Symbol('_libraryVariable='), | |
| 45 #Predicate, | |
|
gbracha
2013/10/26 18:37:48
So are all the type getters synthetic? I'm not so
rmacnak
2013/10/30 18:50:42
They weren't hand-written.
The Newspeak mirrors d
rmacnak
2013/10/30 18:51:58
It would also allow the maps to provide the functi
gbracha
2013/10/30 18:58:40
Since this is topLevelMembers, not declarations, I
| |
| 46 #Superclass, | |
| 47 #Interface, | |
| 48 #Mixin, | |
| 49 #_PrivateClass, | |
| 50 #ConcreteClass], | |
| 51 selectKeys(lm.toplevelMembers, (dm) => dm.isSynthetic)); | |
| 52 } | |
| OLD | NEW |