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

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

Issue 1364803003: Use TypeSystem in the 'Extract Method' refactoring. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/refactoring/abstract_refactoring.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 da79930df9a411e83763e1be010e622f8f932ecd..e83082b54c262d65ca6da4146e584a5c5ddba81d 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -594,7 +594,7 @@ class ExtractMethodRefactoringImpl extends RefactoringImpl
}
// maybe ends with "return" statement
if (_selectionStatements != null) {
- _ReturnTypeComputer returnTypeComputer = new _ReturnTypeComputer();
+ _ReturnTypeComputer returnTypeComputer = new _ReturnTypeComputer(context);
_selectionStatements.forEach((statement) {
statement.accept(returnTypeComputer);
});
@@ -1158,8 +1158,12 @@ class _Occurrence {
}
class _ReturnTypeComputer extends RecursiveAstVisitor {
+ final AnalysisContext context;
+
DartType returnType;
+ _ReturnTypeComputer(this.context);
+
@override
visitBlockFunctionBody(BlockFunctionBody node) {}
@@ -1182,7 +1186,8 @@ class _ReturnTypeComputer extends RecursiveAstVisitor {
if (returnType is InterfaceType && type is InterfaceType) {
returnType = InterfaceType.getSmartLeastUpperBound(returnType, type);
} else {
- returnType = returnType.getLeastUpperBound(type);
+ returnType = context.typeSystem
+ .getLeastUpperBound(context.typeProvider, returnType, type);
}
}
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698