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

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

Issue 2700843002: Use absolute URIs for LinkedDependency.uri/parts. (Closed)
Patch Set: Created 3 years, 10 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
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index aeec4b4c2a5b3597d0f27363e925a5d8723297af..a83505e229f0f384ed50978df6caa54a33bb357e 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -1083,15 +1083,12 @@ class _LibraryResynthesizer {
return <String>[referencedLibraryUri, partUri, name];
}
LinkedDependency dependency = linkedLibrary.dependencies[dependencyIndex];
- Source referencedLibrarySource = summaryResynthesizer.sourceFactory
- .resolveUri(librarySource, dependency.uri);
+ Source referencedLibrarySource =
+ summaryResynthesizer.sourceFactory.forUri(dependency.uri);
String referencedLibraryUri = referencedLibrarySource.uri.toString();
String partUri;
if (unit != 0) {
- String uri = dependency.parts[unit - 1];
- Source partSource =
- summaryResynthesizer.sourceFactory.resolveUri(librarySource, uri);
- partUri = partSource.uri.toString();
+ partUri = dependency.parts[unit - 1];
} else {
partUri = referencedLibraryUri;
}
@@ -1134,7 +1131,7 @@ class _LibraryResynthesizerContext implements LibraryResynthesizerContext {
@override
LibraryElement buildImportedLibrary(int dependency) {
String depUri = resynthesizer.linkedLibrary.dependencies[dependency].uri;
- return _getLibraryByRelativeUri(depUri);
+ return _getLibraryByAbsoluteUri(depUri);
}
@override
@@ -1160,6 +1157,16 @@ class _LibraryResynthesizerContext implements LibraryResynthesizerContext {
BuildLibraryElementUtils.patchTopLevelAccessors(library);
}
+ LibraryElementHandle _getLibraryByAbsoluteUri(String uriStr) {
+ Source source =
+ resynthesizer.summaryResynthesizer.sourceFactory.forUri(uriStr);
+ if (source == null) {
+ return null;
+ }
+ return new LibraryElementHandle(resynthesizer.summaryResynthesizer,
+ new ElementLocationImpl.con3(<String>[uriStr]));
+ }
+
LibraryElementHandle _getLibraryByRelativeUri(String depUri) {
Source source = resynthesizer.summaryResynthesizer.sourceFactory
.resolveUri(resynthesizer.librarySource, depUri);

Powered by Google App Engine
This is Rietveld 408576698