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

Unified Diff: pkg/analyzer/lib/src/summary/package_bundle_reader.dart

Issue 1831563002: expose InSummarySource with its summaryPath (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix test too Created 4 years, 9 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/test/src/summary/in_summary_source_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/package_bundle_reader.dart
diff --git a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
index d2b3455a811cfa1c0201e933aa0b8eeb9f9dfb2e..13800da71b62c4b8614e2ec6d8f66974aa8acf98 100644
--- a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
@@ -101,7 +101,8 @@ class InSummaryPackageUriResolver extends UriResolver {
Source resolveAbsolute(Uri uri, [Uri actualUri]) {
actualUri ??= uri;
if (_dataStore.unlinkedMap.containsKey(uri.toString())) {
- return new _InSummarySource(actualUri);
+ return new InSummarySource(
+ actualUri, _dataStore.uriToSummaryPath[uri.toString()]);
}
return null;
}
@@ -124,6 +125,11 @@ class SummaryDataStore {
*/
final Map<String, LinkedLibrary> linkedMap = <String, LinkedLibrary>{};
+ /**
+ * Map from the URI of a library to the summary path that contained it.
+ */
+ final Map<String, String> uriToSummaryPath = <String, String>{};
+
SummaryDataStore(Iterable<String> summaryPaths) {
summaryPaths.forEach(_fillMaps);
}
@@ -133,10 +139,13 @@ class SummaryDataStore {
List<int> buffer = file.readAsBytesSync();
PackageBundle bundle = new PackageBundle.fromBuffer(buffer);
for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) {
- unlinkedMap[bundle.unlinkedUnitUris[i]] = bundle.unlinkedUnits[i];
+ String uri = bundle.unlinkedUnitUris[i];
+ uriToSummaryPath[uri] = path;
+ unlinkedMap[uri] = bundle.unlinkedUnits[i];
}
for (int i = 0; i < bundle.linkedLibraryUris.length; i++) {
- linkedMap[bundle.linkedLibraryUris[i]] = bundle.linkedLibraries[i];
+ String uri = bundle.linkedLibraryUris[i];
+ linkedMap[uri] = bundle.linkedLibraries[i];
}
}
}
@@ -177,10 +186,15 @@ class _FileBasedSummaryResynthesizer extends SummaryResynthesizer {
* are served from its summary. This source uses its URI as [fullName] and has
* empty contents.
*/
-class _InSummarySource extends Source {
+class InSummarySource extends Source {
final Uri uri;
- _InSummarySource(this.uri);
+ /**
+ * The summary file where this source was defined.
+ */
+ final String summaryPath;
+
+ InSummarySource(this.uri, this.summaryPath);
@override
TimestampedData<String> get contents => new TimestampedData<String>(0, '');
@@ -208,7 +222,7 @@ class _InSummarySource extends Source {
@override
bool operator ==(Object object) =>
- object is _InSummarySource && object.uri == uri;
+ object is InSummarySource && object.uri == uri;
@override
bool exists() => true;
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/in_summary_source_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698