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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/src/protocol_server.dart' hide Element; | 7 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
8 import 'package:analysis_server/src/services/correction/name_suggestion.dart'; | 8 import 'package:analysis_server/src/services/correction/name_suggestion.dart'; |
9 import 'package:analysis_server/src/services/correction/selection_analyzer.dart'
; | 9 import 'package:analysis_server/src/services/correction/selection_analyzer.dart'
; |
10 import 'package:analysis_server/src/services/correction/statement_analyzer.dart'
; | 10 import 'package:analysis_server/src/services/correction/statement_analyzer.dart'
; |
11 import 'package:analysis_server/src/services/correction/status.dart'; | 11 import 'package:analysis_server/src/services/correction/status.dart'; |
12 import 'package:analysis_server/src/services/correction/util.dart'; | 12 import 'package:analysis_server/src/services/correction/util.dart'; |
13 import 'package:analysis_server/src/services/refactoring/naming_conventions.dart
'; | 13 import 'package:analysis_server/src/services/refactoring/naming_conventions.dart
'; |
14 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 14 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
15 import 'package:analysis_server/src/services/refactoring/refactoring_internal.da
rt'; | 15 import 'package:analysis_server/src/services/refactoring/refactoring_internal.da
rt'; |
16 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar
t'; | 16 import 'package:analysis_server/src/services/refactoring/rename_class_member.dar
t'; |
17 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart
'; | 17 import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart
'; |
18 import 'package:analysis_server/src/services/search/element_visitors.dart'; | |
19 import 'package:analysis_server/src/services/search/search_engine.dart'; | 18 import 'package:analysis_server/src/services/search/search_engine.dart'; |
20 import 'package:analyzer/dart/ast/ast.dart'; | 19 import 'package:analyzer/dart/ast/ast.dart'; |
21 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 20 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
22 import 'package:analyzer/dart/ast/token.dart'; | 21 import 'package:analyzer/dart/ast/token.dart'; |
23 import 'package:analyzer/dart/ast/visitor.dart'; | 22 import 'package:analyzer/dart/ast/visitor.dart'; |
24 import 'package:analyzer/dart/element/element.dart'; | 23 import 'package:analyzer/dart/element/element.dart'; |
25 import 'package:analyzer/dart/element/type.dart'; | 24 import 'package:analyzer/dart/element/type.dart'; |
26 import 'package:analyzer/src/dart/ast/utilities.dart'; | 25 import 'package:analyzer/src/dart/ast/utilities.dart'; |
27 import 'package:analyzer/src/dart/element/ast_provider.dart'; | 26 import 'package:analyzer/src/dart/element/ast_provider.dart'; |
28 import 'package:analyzer/src/generated/engine.dart'; | 27 import 'package:analyzer/src/generated/engine.dart'; |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 _parentMember.accept(visitor); | 798 _parentMember.accept(visitor); |
800 return visitor.result; | 799 return visitor.result; |
801 } | 800 } |
802 | 801 |
803 /** | 802 /** |
804 * Prepare names that are used in the enclosing function, so should not be | 803 * Prepare names that are used in the enclosing function, so should not be |
805 * proposed as names of the extracted method. | 804 * proposed as names of the extracted method. |
806 */ | 805 */ |
807 void _prepareExcludedNames() { | 806 void _prepareExcludedNames() { |
808 _excludedNames.clear(); | 807 _excludedNames.clear(); |
809 ExecutableElement enclosingExecutable = | 808 List<LocalElement> localElements = getDefinedLocalElements(_parentMember); |
810 getEnclosingExecutableElement(_parentMember); | 809 _excludedNames.addAll(localElements.map((e) => e.name)); |
811 if (enclosingExecutable != null) { | |
812 visitChildren(enclosingExecutable, (Element element) { | |
813 if (element is LocalElement) { | |
814 SourceRange elementRange = element.visibleRange; | |
815 if (elementRange != null) { | |
816 _excludedNames.add(element.displayName); | |
817 } | |
818 } | |
819 return true; | |
820 }); | |
821 } | |
822 } | 810 } |
823 | 811 |
824 void _prepareNames() { | 812 void _prepareNames() { |
825 names.clear(); | 813 names.clear(); |
826 if (_selectionExpression != null) { | 814 if (_selectionExpression != null) { |
827 names.addAll(getVariableNameSuggestionsForExpression( | 815 names.addAll(getVariableNameSuggestionsForExpression( |
828 _selectionExpression.staticType, | 816 _selectionExpression.staticType, |
829 _selectionExpression, | 817 _selectionExpression, |
830 _excludedNames)); | 818 _excludedNames)); |
831 } | 819 } |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 return false; | 1314 return false; |
1327 } | 1315 } |
1328 for (int i = 0; i < parameterTypes.length; i++) { | 1316 for (int i = 0; i < parameterTypes.length; i++) { |
1329 if (other.parameterTypes[i] != parameterTypes[i]) { | 1317 if (other.parameterTypes[i] != parameterTypes[i]) { |
1330 return false; | 1318 return false; |
1331 } | 1319 } |
1332 } | 1320 } |
1333 return true; | 1321 return true; |
1334 } | 1322 } |
1335 } | 1323 } |
OLD | NEW |