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

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

Issue 789543002: Ignore ButtonType when computing an extracted method return type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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/extract_method_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/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 40cad52155906b859cf90c9a53a674fd6d05c1cf..79dad5975f6f39f32742992a0383d8ae01cbb2b5 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -1107,17 +1107,24 @@ class _ReturnTypeComputer extends RecursiveAstVisitor {
@override
visitReturnStatement(ReturnStatement node) {
+ // prepare expression
Expression expression = node.expression;
- if (expression != null) {
- DartType type = expression.bestType;
- if (returnType == null) {
- returnType = type;
+ if (expression == null) {
+ return;
+ }
+ // prepare type
+ DartType type = expression.bestType;
+ if (type.isBottom) {
+ return;
+ }
+ // combine types
+ if (returnType == null) {
+ returnType = type;
+ } else {
+ if (returnType is InterfaceType && type is InterfaceType) {
+ returnType = InterfaceType.getSmartLeastUpperBound(returnType, type);
} else {
- if (returnType is InterfaceType && type is InterfaceType) {
- returnType = InterfaceType.getSmartLeastUpperBound(returnType, type);
- } else {
- returnType = returnType.getLeastUpperBound(type);
- }
+ returnType = returnType.getLeastUpperBound(type);
}
}
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/refactoring/extract_method_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698