File tree 1 file changed +22
-2
lines changed
pkg/front_end/lib/src/kernel/macro 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -839,8 +839,28 @@ class _DeclarationPhaseIntrospector extends _TypePhaseIntrospector
839
839
840
840
@override
841
841
Future <List <macro.TypeDeclaration >> typesOf (covariant macro .Library library) {
842
- // TODO: implement typesOf
843
- throw new UnimplementedError ();
842
+ Uri uri = library.uri;
843
+ LibraryBuilder ? libraryBuilder =
844
+ sourceLoader.lookupLoadedLibraryBuilder (uri);
845
+ if (libraryBuilder == null ) {
846
+ return new Future .error (
847
+ new macro .MacroImplementationExceptionImpl (
848
+ 'Library at uri $uri could not be resolved.' ),
849
+ StackTrace .current);
850
+ }
851
+
852
+ List <macro.TypeDeclaration > result = [];
853
+ Iterator <Builder > iterator = libraryBuilder.localMembersIterator;
854
+ while (iterator.moveNext ()) {
855
+ Builder builder = iterator.current;
856
+ // TODO(scheglov): This switch is not complete.
857
+ switch (builder) {
858
+ case ClassBuilder ():
859
+ result.add (_introspection.getClassDeclaration (builder));
860
+ }
861
+ }
862
+
863
+ return new Future .value (result);
844
864
}
845
865
846
866
@override
You can’t perform that action at this time.
0 commit comments