File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1+ ## 0.5.2-dev
2+
3+ * Use library URIs (not names) to look up annotations in the mirror system.
4+
15## 0.5.1+7
26
37* Generate valid strong-mode code for typed lists.
Original file line number Diff line number Diff line change @@ -192,9 +192,22 @@ DeclarationMirror _getDeclarationMirrorFromType(InterfaceType type) {
192192 var system = currentMirrorSystem ();
193193
194194 // find library
195- var libElement = type.element.library;
196- var libNameSymbol = new Symbol (libElement.name);
197- var libMirror = system.findLibrary (libNameSymbol);
195+ var libraryUri = type.element.library.librarySource.uri;
196+
197+ if (libraryUri.scheme == 'asset' ) {
198+ // see if it looks like a package
199+ var segs = libraryUri.pathSegments.toList ();
200+ if (segs.length >= 2 && segs[1 ] == 'lib' ) {
201+ segs.removeAt (1 );
202+ libraryUri = new Uri (scheme: 'package' , pathSegments: segs);
203+ } else {
204+ // TODO: we should support this. Just would take some time.
205+ throw new UnsupportedError ('Generator annotations must be defined within '
206+ 'a package lib directory.' );
207+ }
208+ }
209+
210+ var libMirror = system.libraries[libraryUri];
198211
199212 // find class symbol
200213 var typeNameSymbol = new Symbol (type.name);
Original file line number Diff line number Diff line change 11name : source_gen
2- version : 0.5.1+7
2+ version : 0.5.2-dev
33author :
Dart Team <[email protected] > 44description : Automatic sourcecode generation for Dart
55homepage : https://github.com/dart-lang/source_gen
You can’t perform that action at this time.
0 commit comments