Skip to content

Commit b23e37d

Browse files
authored
Fix incompatibilities with new Analyzer. (#1768)
1 parent b744afa commit b23e37d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/src/model.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,10 +2310,12 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
23102310
}
23112311

23122312
static String getLibraryName(LibraryElement element) {
2313+
var source = element.source;
2314+
23132315
String name = element.name;
23142316
if (name == null || name.isEmpty) {
23152317
// handle the case of an anonymous library
2316-
name = element.definingCompilationUnit.name;
2318+
name = pathLib.basename(source.fullName);
23172319

23182320
if (name.endsWith('.dart')) {
23192321
name = name.substring(0, name.length - '.dart'.length);
@@ -2325,7 +2327,6 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
23252327
// name is to get source.encoding.
23262328
// This may be wrong or misleading, but developers expect the name
23272329
// of dart:____
2328-
var source = element.definingCompilationUnit.source;
23292330
name = source.isInSystemLibrary ? source.encoding : name;
23302331

23312332
return name;
@@ -5938,8 +5939,9 @@ class PackageBuilder {
59385939

59395940
for (String name in info.packages) {
59405941
Uri uri = info.asMap()[name];
5942+
String path = pathLib.normalize(pathLib.fromUri(uri));
59415943
fileSystem.Resource resource =
5942-
PhysicalResourceProvider.INSTANCE.getResource(uri.toFilePath());
5944+
PhysicalResourceProvider.INSTANCE.getResource(path);
59435945
if (resource is fileSystem.Folder) {
59445946
map[name] = [resource];
59455947
}

0 commit comments

Comments
 (0)