Index: pkg/analysis_server/lib/src/services/correction/util.dart |
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart |
index babfeeec4b548dbf35b51616b82feefb0abdb901..d5eeeb0aba3443b26d6cfcd39dc06589ff45d40f 100644 |
--- a/pkg/analysis_server/lib/src/services/correction/util.dart |
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart |
@@ -29,8 +29,8 @@ import 'package:path/path.dart'; |
* Adds edits to the given [change] that ensure that all the [libraries] are |
* imported into the given [targetLibrary]. |
*/ |
-void addLibraryImports(SourceChange change, LibraryElement targetLibrary, |
- Set<LibraryElement> libraries) { |
+void addLibraryImports( |
+ SourceChange change, LibraryElement targetLibrary, Set<Source> libraries) { |
CorrectionUtils libUtils; |
try { |
CompilationUnitElement unitElement = targetLibrary.definingCompilationUnit; |
@@ -54,7 +54,7 @@ void addLibraryImports(SourceChange change, LibraryElement targetLibrary, |
// Prepare all URIs to import. |
List<String> uriList = libraries |
- .map((library) => getLibrarySourceUri(targetLibrary, library.source)) |
+ .map((library) => getLibrarySourceUri(targetLibrary, library)) |
.toList(); |
uriList.sort((a, b) => a.compareTo(b)); |
@@ -367,7 +367,7 @@ Map<String, Element> getImportNamespace(ImportElement imp) { |
* Computes the best URI to import [what] into [from]. |
*/ |
String getLibrarySourceUri(LibraryElement from, Source what) { |
- String whatFile = what.fullName; |
+ String whatPath = what.fullName; |
// check if an absolute URI (such as 'dart:' or 'package:') |
Uri whatUri = what.uri; |
String whatUriScheme = whatUri.scheme; |
@@ -376,7 +376,7 @@ String getLibrarySourceUri(LibraryElement from, Source what) { |
} |
// compute a relative URI |
String fromFolder = dirname(from.source.fullName); |
- String relativeFile = relative(whatFile, from: fromFolder); |
+ String relativeFile = relative(whatPath, from: fromFolder); |
return split(relativeFile).join('/'); |
} |
@@ -765,7 +765,7 @@ class CorrectionUtils { |
* if can not be resolved, should be treated as the `dynamic` type. |
*/ |
String getExpressionTypeSource( |
- Expression expression, Set<LibraryElement> librariesToImport) { |
+ Expression expression, Set<Source> librariesToImport) { |
if (expression == null) { |
return null; |
} |
@@ -1054,7 +1054,7 @@ class CorrectionUtils { |
* @return the source for the parameter with the given type and name. |
*/ |
String getParameterSource( |
- DartType type, String name, Set<LibraryElement> librariesToImport) { |
+ DartType type, String name, Set<Source> librariesToImport) { |
// no type |
if (type == null || type.isDynamic) { |
return name; |
@@ -1121,7 +1121,7 @@ class CorrectionUtils { |
* Fills [librariesToImport] with [LibraryElement]s whose elements are |
* used by the generated source, but not imported. |
*/ |
- String getTypeSource(DartType type, Set<LibraryElement> librariesToImport, |
+ String getTypeSource(DartType type, Set<Source> librariesToImport, |
{StringBuffer parametersBuffer}) { |
StringBuffer sb = new StringBuffer(); |
// type parameter |
@@ -1173,7 +1173,7 @@ class CorrectionUtils { |
sb.write("."); |
} |
} else { |
- librariesToImport.add(library); |
+ librariesToImport.add(library.source); |
} |
} |
// append simple name |