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

Unified Diff: pkg/analyzer/lib/source/sdk_ext.dart

Issue 2133873003: Handle SDK extensions in the SDK (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | pkg/analyzer/lib/src/context/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3e833dfaa3f59fc67cef426b30a0552c5da45cbe..f25d65e0d7613dd388b8d798ac60cd5ff63c705f 100644
--- a/pkg/analyzer/lib/source/sdk_ext.dart
+++ b/pkg/analyzer/lib/source/sdk_ext.dart
@@ -31,6 +31,12 @@ class SdkExtUriResolver extends UriResolver {
final Map<String, String> _urlMappings = <String, String>{};
+ /**
+ * The absolute paths of the extension files that contributed to the
+ * [_urlMappings].
+ */
+ final List<String> extensionFilePaths = <String>[];
+
/// Construct a [SdkExtUriResolver] from a package map
/// (see [PackageMapProvider]).
SdkExtUriResolver(Map<String, List<Folder>> packageMap) {
@@ -147,18 +153,27 @@ class SdkExtUriResolver extends UriResolver {
if ((sdkExt == null) || (sdkExt is! Map)) {
return;
}
- sdkExt.forEach((k, v) => _processSdkExtension(k, v, libDir));
+ bool contributed = false;
+ sdkExt.forEach((k, v) {
+ if (_processSdkExtension(k, v, libDir)) {
+ contributed = true;
+ }
+ });
+ if (contributed) {
+ extensionFilePaths.add(libDir.getChild(SDK_EXT_NAME).path);
+ }
}
/// Install the mapping from [name] to [libDir]/[file].
- void _processSdkExtension(String name, String file, Folder libDir) {
+ bool _processSdkExtension(String name, String file, Folder libDir) {
if (!name.startsWith(DART_COLON_PREFIX)) {
// SDK extensions must begin with 'dart:'.
- return;
+ return false;
}
var key = name;
var value = libDir.canonicalizePath(file);
_urlMappings[key] = value;
+ return true;
}
/// Read the contents of [libDir]/[SDK_EXT_NAME] as a string.
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698