| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library services.src.refactoring.extract_method; | 5 library services.src.refactoring.extract_method; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol_server.dart' hide Element; | 9 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
| 10 import 'package:analysis_server/src/services/correction/name_suggestion.dart'; | 10 import 'package:analysis_server/src/services/correction/name_suggestion.dart'; |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 @override | 1108 @override |
| 1109 visitReturnStatement(ReturnStatement node) { | 1109 visitReturnStatement(ReturnStatement node) { |
| 1110 Expression expression = node.expression; | 1110 Expression expression = node.expression; |
| 1111 if (expression != null) { | 1111 if (expression != null) { |
| 1112 DartType type = expression.bestType; | 1112 DartType type = expression.bestType; |
| 1113 if (returnType == null) { | 1113 if (returnType == null) { |
| 1114 returnType = type; | 1114 returnType = type; |
| 1115 } else { | 1115 } else { |
| 1116 returnType = returnType.getLeastUpperBound(type); | 1116 if (returnType is InterfaceType && type is InterfaceType) { |
| 1117 returnType = InterfaceType.getSmartLeastUpperBound(returnType, type); |
| 1118 } else { |
| 1119 returnType = returnType.getLeastUpperBound(type); |
| 1120 } |
| 1117 } | 1121 } |
| 1118 } | 1122 } |
| 1119 } | 1123 } |
| 1120 } | 1124 } |
| 1121 | 1125 |
| 1122 | 1126 |
| 1123 /** | 1127 /** |
| 1124 * Generalized version of some source, in which references to the specific | 1128 * Generalized version of some source, in which references to the specific |
| 1125 * variables are replaced with pattern variables, with back mapping from the | 1129 * variables are replaced with pattern variables, with back mapping from the |
| 1126 * pattern to the original variable names. | 1130 * pattern to the original variable names. |
| 1127 */ | 1131 */ |
| 1128 class _SourcePattern { | 1132 class _SourcePattern { |
| 1129 String patternSource; | 1133 String patternSource; |
| 1130 Map<String, String> originalToPatternNames = {}; | 1134 Map<String, String> originalToPatternNames = {}; |
| 1131 } | 1135 } |
| OLD | NEW |