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

Unified Diff: pkg/analysis_server/lib/src/services/refactoring/extract_method.dart

Issue 706263003: Issue 20827. Add imports as needed the 'Add type annotation' Quick Assist. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « pkg/analysis_server/lib/src/services/correction/util.dart ('k') | pkg/analysis_server/test/mock_sdk.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/refactoring/extract_method.dart
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
index f093266db378a06a1ef53a881860ea0e9198194c..15b4ab6a95bbda3c026689f8de3b64cfda08c92f 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -305,8 +305,10 @@ class ExtractMethodRefactoringImpl extends RefactoringImpl implements
// expression
if (_selectionExpression != null) {
// add return type
+ Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
+ // TODO(scheglov) use librariesToImport
String returnTypeName =
- utils.getExpressionTypeSource(_selectionExpression);
+ utils.getExpressionTypeSource(_selectionExpression, librariesToImport);
if (returnTypeName != null && returnTypeName != 'dynamic') {
annotations += '${returnTypeName} ';
}
@@ -618,7 +620,9 @@ class ExtractMethodRefactoringImpl extends RefactoringImpl implements
if (_returnType == null) {
returnType = 'void';
} else {
- returnType = utils.getTypeSource(_returnType);
+ Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
+ // TODO(scheglov) use librariesToImport
+ returnType = utils.getTypeSource(_returnType, librariesToImport);
}
if (returnType == 'dynamic') {
returnType = '';
@@ -939,7 +943,8 @@ class _InitializeOccurrencesVisitor extends GeneralizingAstVisitor<Object> {
new _Occurrence(nodeRange, ref.selectionRange.intersects(nodeRange));
ref._occurrences.add(occurrence);
// prepare mapping of parameter names to the occurrence variables
- nodePattern.originalToPatternNames.forEach((String originalName, String patternName) {
+ nodePattern.originalToPatternNames.forEach(
+ (String originalName, String patternName) {
String selectionName = patternToSelectionName[patternName];
occurrence._parameterOldToOccurrenceName[selectionName] = originalName;
});
@@ -999,7 +1004,10 @@ class _InitializeParametersVisitor extends GeneralizingAstVisitor<Object> {
ref._parametersMap[variableName];
if (parameter == null) {
DartType parameterType = node.bestType;
- String parameterTypeName = ref.utils.getTypeSource(parameterType);
+ Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
+ // TODO(scheglov) use librariesToImport
+ String parameterTypeName =
+ ref.utils.getTypeSource(parameterType, librariesToImport);
parameter = new RefactoringMethodParameter(
RefactoringMethodParameterKind.REQUIRED,
parameterTypeName,
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/util.dart ('k') | pkg/analysis_server/test/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698