Index: pkg/analysis_server/lib/src/services/refactoring/extract_local.dart |
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart |
index 8fa0c44b3e1f72970a43fa848af52c8146ebc8e1..e1c24429329f31ecd859224eb17d743ede1d51a0 100644 |
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart |
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart |
@@ -10,7 +10,6 @@ import 'dart:collection'; |
import 'package:analysis_server/src/protocol_server.dart' hide Element; |
import 'package:analysis_server/src/services/correction/name_suggestion.dart'; |
import 'package:analysis_server/src/services/correction/selection_analyzer.dart'; |
-import 'package:analysis_server/src/services/correction/source_range.dart'; |
import 'package:analysis_server/src/services/correction/status.dart'; |
import 'package:analysis_server/src/services/correction/strings.dart'; |
import 'package:analysis_server/src/services/correction/util.dart'; |
@@ -24,6 +23,7 @@ import 'package:analyzer/dart/element/element.dart'; |
import 'package:analyzer/src/dart/ast/utilities.dart'; |
import 'package:analyzer/src/generated/java_core.dart'; |
import 'package:analyzer/src/generated/source.dart'; |
+import 'package:analyzer_plugin/utilities/range_factory.dart'; |
const String _TOKEN_SEPARATOR = "\uFFFF"; |
@@ -324,7 +324,7 @@ class ExtractLocalRefactoringImpl extends RefactoringImpl |
// single node selected |
if (rootExpression != null) { |
singleExpression = rootExpression; |
- selectionRange = rangeNode(singleExpression); |
+ selectionRange = range.node(singleExpression); |
wholeStatementExpression = singleExpression.parent is ExpressionStatement; |
return new RefactoringStatus(); |
} |
@@ -608,7 +608,7 @@ class _OccurrencesVisitor extends GeneralizingAstVisitor<Object> { |
@override |
Object visitExpression(Expression node) { |
- if (ref._isExtractable(rangeNode(node))) { |
+ if (ref._isExtractable(range.node(node))) { |
_tryToFindOccurrence(node); |
} |
return super.visitExpression(node); |
@@ -627,7 +627,7 @@ class _OccurrencesVisitor extends GeneralizingAstVisitor<Object> { |
} |
lastIndex = index + length; |
int start = node.offset + index; |
- SourceRange range = rangeStartLength(start, length); |
+ SourceRange range = new SourceRange(start, length); |
occurrences.add(range); |
} |
return null; |
@@ -654,8 +654,7 @@ class _OccurrencesVisitor extends GeneralizingAstVisitor<Object> { |
List<Token> nodeTokens = TokenUtils.getTokens(nodeSource); |
nodeSource = ref._encodeExpressionTokens(node, nodeTokens); |
if (nodeSource == selectionSource) { |
- SourceRange range = rangeNode(node); |
- _addOccurrence(range); |
+ _addOccurrence(range.node(node)); |
} |
} |
@@ -683,8 +682,7 @@ class _OccurrencesVisitor extends GeneralizingAstVisitor<Object> { |
// add occurrence range |
int start = nodeOffset + startToken.offset; |
int end = nodeOffset + endToken.end; |
- SourceRange range = rangeStartEnd(start, end); |
- _addOccurrence(range); |
+ _addOccurrence(range.offsetEndIndex(start, end)); |
} |
} |
} |