@@ -195,6 +195,8 @@ void main() {
195195        @VisibleClass.secret() 
196196        @fieldOnly 
197197        @ClassWithStaticField.staticField 
198+         @Wrapper(someFunction) 
199+         @Wrapper(Wrapper.someFunction) 
198200        class Example {} 
199201         
200202        class Int64Like { 
@@ -238,6 +240,14 @@ void main() {
238240          static const staticField = const ClassWithStaticField._(); 
239241          const ClassWithStaticField._(); 
240242        } 
243+ 
244+         class Wrapper { 
245+           static void someFunction(int x, String y) {} 
246+           final Function f; 
247+           const Wrapper(this.f); 
248+         } 
249+ 
250+         void someFunction(int x, String y) {} 
241251      ''' , (resolver) =>  resolver.findLibraryByName ('test_lib' ));
242252      constants =  library
243253          .getType ('Example' )
@@ -293,5 +303,17 @@ void main() {
293303      expect (fieldOnly.source.fragment, isEmpty);
294304      expect (fieldOnly.accessor, 'ClassWithStaticField.staticField' );
295305    });
306+ 
307+     test ('should decode top-level functions' , () {
308+       final  fieldOnly =  constants[7 ].read ('f' ).revive ();
309+       expect (fieldOnly.source.fragment, isEmpty);
310+       expect (fieldOnly.accessor, 'someFunction' );
311+     });
312+ 
313+     test ('should decode static-class functions' , () {
314+       final  fieldOnly =  constants[8 ].read ('f' ).revive ();
315+       expect (fieldOnly.source.fragment, isEmpty);
316+       expect (fieldOnly.accessor, 'Wrapper.someFunction' );
317+     });
296318  });
297319}
0 commit comments