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

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

Issue 2969343002: Stop depending of visiting LocalVariableElement(s) in Executableelement.visitChildren(). (Closed)
Patch Set: Created 3 years, 5 months 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
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 e93bdd4f24196d6d166f0610d6d67f32eada17f5..032924c039a313d60366084c55403fe10ddfd9db 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -15,7 +15,6 @@ import 'package:analysis_server/src/services/refactoring/refactoring.dart';
import 'package:analysis_server/src/services/refactoring/refactoring_internal.dart';
import 'package:analysis_server/src/services/refactoring/rename_class_member.dart';
import 'package:analysis_server/src/services/refactoring/rename_unit_member.dart';
-import 'package:analysis_server/src/services/search/element_visitors.dart';
import 'package:analysis_server/src/services/search/search_engine.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/standard_resolution_map.dart';
@@ -806,19 +805,8 @@ class ExtractMethodRefactoringImpl extends RefactoringImpl
*/
void _prepareExcludedNames() {
_excludedNames.clear();
- ExecutableElement enclosingExecutable =
- getEnclosingExecutableElement(_parentMember);
- if (enclosingExecutable != null) {
- visitChildren(enclosingExecutable, (Element element) {
- if (element is LocalElement) {
- SourceRange elementRange = element.visibleRange;
- if (elementRange != null) {
- _excludedNames.add(element.displayName);
- }
- }
- return true;
- });
- }
+ List<LocalElement> localElements = getDefinedLocalElements(_parentMember);
+ _excludedNames.addAll(localElements.map((e) => e.name));
}
void _prepareNames() {

Powered by Google App Engine
This is Rietveld 408576698