Index: pkg/analyzer/lib/source/sdk_ext.dart |
diff --git a/pkg/analyzer/lib/source/sdk_ext.dart b/pkg/analyzer/lib/source/sdk_ext.dart |
index 7caad4359c4ef100b357fa9c7f2315a3a0e7a1fa..d16bb4775ed28d1c5aaacfb7d7f903f39636e5ab 100644 |
--- a/pkg/analyzer/lib/source/sdk_ext.dart |
+++ b/pkg/analyzer/lib/source/sdk_ext.dart |
@@ -76,13 +76,25 @@ class SdkExtUriResolver extends UriResolver { |
@override |
Uri restoreAbsolute(Source source) { |
- String libraryName = _libraryName(source.uri); |
- if (_registeredSdkExtension(libraryName)) { |
- return source.uri; |
+ String extensionName = _findExtensionNameFor(source.fullName); |
+ if (extensionName != null) { |
+ return Uri.parse(extensionName); |
} |
+ // TODO(johnmccutchan): Handle restoring parts. |
return null; |
} |
+ /// Return the extension name for [fullName] or `null`. |
+ String _findExtensionNameFor(String fullName) { |
+ var result; |
+ _urlMappings.forEach((extensionName, pathMapping) { |
+ if (pathMapping == fullName) { |
+ result = extensionName; |
+ } |
+ }); |
+ return result; |
+ } |
+ |
/// Return the library name of [importUri]. |
String _libraryName(Uri importUri) { |
var uri = importUri.toString(); |
@@ -152,11 +164,6 @@ class SdkExtUriResolver extends UriResolver { |
} |
} |
- /// Returns true if [libraryName] is a registered sdk extension. |
- bool _registeredSdkExtension(String libraryName) { |
- return _urlMappings[libraryName] != null; |
- } |
- |
/// Resolve an import of an sdk extension. |
Source _resolveEntry(Uri libraryEntry, Uri importUri) { |
// Library entry. |