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

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

Issue 730803003: Use a better way to compute InterfaceTypes least upper bound. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/refactoring/extract_method_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« 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