@@ -2310,10 +2310,12 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
2310
2310
}
2311
2311
2312
2312
static String getLibraryName (LibraryElement element) {
2313
+ var source = element.source;
2314
+
2313
2315
String name = element.name;
2314
2316
if (name == null || name.isEmpty) {
2315
2317
// handle the case of an anonymous library
2316
- name = element.definingCompilationUnit.name ;
2318
+ name = pathLib. basename (source.fullName) ;
2317
2319
2318
2320
if (name.endsWith ('.dart' )) {
2319
2321
name = name.substring (0 , name.length - '.dart' .length);
@@ -2325,7 +2327,6 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
2325
2327
// name is to get source.encoding.
2326
2328
// This may be wrong or misleading, but developers expect the name
2327
2329
// of dart:____
2328
- var source = element.definingCompilationUnit.source;
2329
2330
name = source.isInSystemLibrary ? source.encoding : name;
2330
2331
2331
2332
return name;
@@ -5938,8 +5939,9 @@ class PackageBuilder {
5938
5939
5939
5940
for (String name in info.packages) {
5940
5941
Uri uri = info.asMap ()[name];
5942
+ String path = pathLib.normalize (pathLib.fromUri (uri));
5941
5943
fileSystem.Resource resource =
5942
- PhysicalResourceProvider .INSTANCE .getResource (uri. toFilePath () );
5944
+ PhysicalResourceProvider .INSTANCE .getResource (path );
5943
5945
if (resource is fileSystem.Folder ) {
5944
5946
map[name] = [resource];
5945
5947
}
0 commit comments