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

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

Issue 1910343002: Fix summary resynthesis in the event of a self-import. (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 | « no previous file | pkg/analyzer/test/src/summary/prelinker_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/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index 63a7f0f022f03d2243ba518475b84a939eb3906f..23fecd5a870969b0679f97d818123bcc2434c8e7 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -1054,18 +1054,25 @@ class _LibraryResynthesizer {
/**
* Resynthesize an [ImportElement].
*/
- ImportElement buildImport(_UnitResynthesizer definingUnitResynthesizer,
- UnlinkedImport serializedImport, int dependency) {
+ ImportElement buildImport(
+ _UnitResynthesizer definingUnitResynthesizer,
+ UnlinkedImport serializedImport,
+ int dependency,
+ LibraryElement libraryBeingResynthesized) {
bool isSynthetic = serializedImport.isImplicit;
ImportElementImpl importElement =
new ImportElementImpl(isSynthetic ? -1 : serializedImport.offset);
- String absoluteUri = summaryResynthesizer.sourceFactory
- .resolveUri(librarySource, linkedLibrary.dependencies[dependency].uri)
- .uri
- .toString();
- importElement.importedLibrary = new LibraryElementHandle(
- summaryResynthesizer,
- new ElementLocationImpl.con3(<String>[absoluteUri]));
+ if (dependency == 0) {
+ importElement.importedLibrary = libraryBeingResynthesized;
+ } else {
+ String absoluteUri = summaryResynthesizer.sourceFactory
+ .resolveUri(librarySource, linkedLibrary.dependencies[dependency].uri)
+ .uri
+ .toString();
+ importElement.importedLibrary = new LibraryElementHandle(
+ summaryResynthesizer,
+ new ElementLocationImpl.con3(<String>[absoluteUri]));
+ }
if (isSynthetic) {
importElement.synthetic = true;
} else {
@@ -1130,7 +1137,8 @@ class _LibraryResynthesizer {
imports.add(buildImport(
definingUnitResynthesizer,
unlinkedDefiningUnit.imports[i],
- linkedLibrary.importDependencies[i]));
+ linkedLibrary.importDependencies[i],
+ library));
}
library.imports = imports;
// Create exports.
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/prelinker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698