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

Unified Diff: pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Issue 1413973007: Issue 24714. Check other libraries that define unresolved class. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/correction/fix_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index b97fb61d07ad1b16e316a41b43ac47964020223b..a6f30996f764cb4478efd28223f74ccd7307b9ab 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -1339,6 +1339,7 @@ class FixProcessor {
}
// may be there is an existing import,
// but it is with prefix and we don't use this prefix
+ Set<Source> alreadyImportedWithPrefix = new Set<Source>();
for (ImportElement imp in unitLibraryElement.imports) {
// prepare element
LibraryElement libraryElement = imp.importedLibrary;
@@ -1375,13 +1376,13 @@ class FixProcessor {
if (libraryElement.isInSdk) {
libraryName = imp.uri;
}
+ // don't add this library again
+ alreadyImportedWithPrefix.add(libraryElement.source);
// update library
String newShowCode = 'show ${StringUtils.join(showNames, ", ")}';
_addReplaceEdit(
rf.rangeOffsetEnd(showCombinator), newShowCode, unitLibraryElement);
_addFix(DartFixKind.IMPORT_LIBRARY_SHOW, [libraryName]);
- // we support only one import without prefix
- return;
}
}
// check SDK libraries
@@ -1422,6 +1423,10 @@ class FixProcessor {
if (librarySource.isInSystemLibrary) {
continue;
}
+ // maybe already imported with a prefix
+ if (alreadyImportedWithPrefix.contains(librarySource)) {
+ continue;
+ }
// prepare LibraryElement
LibraryElement libraryElement =
context.getLibraryElement(librarySource);
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698