Skip to content

Fix incompatibilities with new Analyzer. #1768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2310,10 +2310,12 @@ class Library extends ModelElement with Categorization, TopLevelContainer {
}

static String getLibraryName(LibraryElement element) {
var source = element.source;

String name = element.name;
if (name == null || name.isEmpty) {
// handle the case of an anonymous library
name = element.definingCompilationUnit.name;
name = pathLib.basename(source.fullName);

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

return name;
Expand Down Expand Up @@ -5938,8 +5939,9 @@ class PackageBuilder {

for (String name in info.packages) {
Uri uri = info.asMap()[name];
String path = pathLib.normalize(pathLib.fromUri(uri));
fileSystem.Resource resource =
PhysicalResourceProvider.INSTANCE.getResource(uri.toFilePath());
PhysicalResourceProvider.INSTANCE.getResource(path);
if (resource is fileSystem.Folder) {
map[name] = [resource];
}
Expand Down