Index: tests/lib/mirrors/toplevel_members_test.dart |
diff --git a/tests/lib/mirrors/toplevel_members_test.dart b/tests/lib/mirrors/toplevel_members_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8638b9a539535131ff5f663e55066c9a8f4fbf86 |
--- /dev/null |
+++ b/tests/lib/mirrors/toplevel_members_test.dart |
@@ -0,0 +1,52 @@ |
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+library test.toplevel_members; |
+ |
+import 'dart:mirrors'; |
+import 'package:expect/expect.dart'; |
+ |
+import 'stringify.dart'; |
+import 'declarations_model.dart' as declarations_model; |
+ |
+selectKeys(map, predicate) { |
+ return map.keys.where((key) => predicate(map[key])); |
+} |
+ |
+main() { |
+ LibraryMirror lm = |
+ currentMirrorSystem().findLibrary(#test.declarations_model).single; |
+ |
+ Expect.setEquals( |
+ [#libraryVariable, |
+ const Symbol('libraryVariable='), |
+ #libraryGetter, |
+ const Symbol('librarySetter='), |
+ #libraryMethod, |
+ #_libraryVariable, |
+ const Symbol('_libraryVariable='), |
+ #_libraryGetter, |
+ const Symbol('_librarySetter='), |
+ #_libraryMethod, |
+ #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
|
+ #Superclass, |
+ #Interface, |
+ #Mixin, |
+ #_PrivateClass, |
+ #ConcreteClass], |
+ selectKeys(lm.toplevelMembers, (dm) => true); |
+ |
+ Expect.setEquals( |
+ [#libraryVariable, |
+ const Symbol('libraryVariable='), |
+ #_libraryVariable, |
+ const Symbol('_libraryVariable='), |
+ #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
|
+ #Superclass, |
+ #Interface, |
+ #Mixin, |
+ #_PrivateClass, |
+ #ConcreteClass], |
+ selectKeys(lm.toplevelMembers, (dm) => dm.isSynthetic)); |
+} |