| 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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 if (identical(node.variables, firstSelectedNode)) { | 852 if (identical(node.variables, firstSelectedNode)) { |
| 853 invalidSelection( | 853 invalidSelection( |
| 854 "Cannot extract initialization part of a 'for' statement."); | 854 "Cannot extract initialization part of a 'for' statement."); |
| 855 } else if (node.updaters.contains(lastSelectedNode)) { | 855 } else if (node.updaters.contains(lastSelectedNode)) { |
| 856 invalidSelection("Cannot extract increment part of a 'for' statement."); | 856 invalidSelection("Cannot extract increment part of a 'for' statement."); |
| 857 } | 857 } |
| 858 return null; | 858 return null; |
| 859 } | 859 } |
| 860 | 860 |
| 861 @override | 861 @override |
| 862 Object visitGenericFunctionType(GenericFunctionType node) { |
| 863 super.visitGenericFunctionType(node); |
| 864 if (_isFirstSelectedNode(node)) { |
| 865 invalidSelection('Cannot extract a single type reference.'); |
| 866 } |
| 867 return null; |
| 868 } |
| 869 |
| 870 @override |
| 862 Object visitSimpleIdentifier(SimpleIdentifier node) { | 871 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 863 super.visitSimpleIdentifier(node); | 872 super.visitSimpleIdentifier(node); |
| 864 if (_isFirstSelectedNode(node)) { | 873 if (_isFirstSelectedNode(node)) { |
| 865 // name of declaration | 874 // name of declaration |
| 866 if (node.inDeclarationContext()) { | 875 if (node.inDeclarationContext()) { |
| 867 invalidSelection('Cannot extract the name part of a declaration.'); | 876 invalidSelection('Cannot extract the name part of a declaration.'); |
| 868 } | 877 } |
| 869 // method name | 878 // method name |
| 870 Element element = node.bestElement; | 879 Element element = node.bestElement; |
| 871 if (element is FunctionElement || element is MethodElement) { | 880 if (element is FunctionElement || element is MethodElement) { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 return false; | 1253 return false; |
| 1245 } | 1254 } |
| 1246 for (int i = 0; i < parameterTypes.length; i++) { | 1255 for (int i = 0; i < parameterTypes.length; i++) { |
| 1247 if (other.parameterTypes[i] != parameterTypes[i]) { | 1256 if (other.parameterTypes[i] != parameterTypes[i]) { |
| 1248 return false; | 1257 return false; |
| 1249 } | 1258 } |
| 1250 } | 1259 } |
| 1251 return true; | 1260 return true; |
| 1252 } | 1261 } |
| 1253 } | 1262 } |
| OLD | NEW |