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

Unified Diff: pkg/analysis_server/lib/src/services/refactoring/inline_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/inline_method.dart
diff --git a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
index 43fe91c6f47cff3f088a1d95e1a84b5f879e7db8..caf7a35f5214cdbd8ce72eabf46acb20009c5518 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
@@ -10,7 +10,6 @@ import 'package:analysis_server/src/services/correction/strings.dart';
import 'package:analysis_server/src/services/correction/util.dart';
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/search/element_visitors.dart';
import 'package:analysis_server/src/services/search/hierarchy.dart';
import 'package:analysis_server/src/services/search/search_engine.dart';
import 'package:analyzer/dart/ast/ast.dart';
@@ -155,17 +154,13 @@ Set<String> _getNamesConflictingAt(AstNode node) {
// local variables and functions
{
SourceRange localsRange = _getLocalsConflictingRange(node);
- ExecutableElement enclosingExecutable = getEnclosingExecutableElement(node);
- if (enclosingExecutable != null) {
- visitChildren(enclosingExecutable, (element) {
- if (element is LocalElement) {
- SourceRange elementRange = element.visibleRange;
- if (elementRange != null && elementRange.intersects(localsRange)) {
- result.add(element.displayName);
- }
- }
- return true;
- });
+ AstNode enclosingExecutable = getEnclosingExecutableNode(node);
+ List<LocalElement> elements = getDefinedLocalElements(enclosingExecutable);
+ for (LocalElement element in elements) {
+ SourceRange elementRange = element.visibleRange;
+ if (elementRange != null && elementRange.intersects(localsRange)) {
+ result.add(element.displayName);
+ }
}
}
// fields

Powered by Google App Engine
This is Rietveld 408576698