Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: pkg/analyzer/lib/src/generated/source_io.dart

Issue 1928623002: Fix ExplicitSourceResolver's handling of missing files. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/source.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/source_io.dart
diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
index 5c9c740f5f5325cb2b9038e0d6025eb44485f246..a4ccf0f94ff05e0a1533f8e789986915f8b60d1b 100644
--- a/pkg/analyzer/lib/src/generated/source_io.dart
+++ b/pkg/analyzer/lib/src/generated/source_io.dart
@@ -98,7 +98,14 @@ class ExplicitSourceResolver extends UriResolver {
@override
Source resolveAbsolute(Uri uri, [Uri actualUri]) {
- return new FileBasedSource(uriToFileMap[uri], actualUri ?? uri);
+ JavaFile file = uriToFileMap[uri];
+ actualUri ??= uri;
+ if (file == null) {
+ return new NonExistingSource(
+ uri.toString(), actualUri, UriKind.fromScheme(actualUri.scheme));
+ } else {
+ return new FileBasedSource(file, actualUri);
+ }
}
@override
@@ -229,14 +236,7 @@ class FileBasedSource extends Source {
@override
UriKind get uriKind {
String scheme = uri.scheme;
- if (scheme == PackageUriResolver.PACKAGE_SCHEME) {
- return UriKind.PACKAGE_URI;
- } else if (scheme == DartUriResolver.DART_SCHEME) {
- return UriKind.DART_URI;
- } else if (scheme == FileUriResolver.FILE_SCHEME) {
- return UriKind.FILE_URI;
- }
- return UriKind.FILE_URI;
+ return UriKind.fromScheme(scheme);
}
@override
« no previous file with comments | « pkg/analyzer/lib/src/generated/source.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698