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.rename_import; | 5 library services.src.refactoring.rename_import; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/protocol_server.dart'; | 9 import 'package:analysis_server/src/protocol_server.dart'; |
10 import 'package:analysis_server/src/services/correction/source_range.dart'; | 10 import 'package:analysis_server/src/services/correction/source_range.dart'; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 /** | 96 /** |
97 * If the given [reference] is before an interpolated [SimpleIdentifier] in | 97 * If the given [reference] is before an interpolated [SimpleIdentifier] in |
98 * an [InterpolationExpression] without surrounding curly brackets, return it. | 98 * an [InterpolationExpression] without surrounding curly brackets, return it. |
99 * Otherwise return `null`. | 99 * Otherwise return `null`. |
100 */ | 100 */ |
101 SimpleIdentifier _getInterpolationIdentifier(SourceReference reference) { | 101 SimpleIdentifier _getInterpolationIdentifier(SourceReference reference) { |
102 Source source = reference.element.source; | 102 Source source = reference.element.source; |
103 CompilationUnit unit = context.parseCompilationUnit(source); | 103 CompilationUnit unit = context.parseCompilationUnit(source); |
104 NodeLocator nodeLocator = new NodeLocator.con1(reference.range.offset); | 104 NodeLocator nodeLocator = new NodeLocator(reference.range.offset); |
105 AstNode node = nodeLocator.searchWithin(unit); | 105 AstNode node = nodeLocator.searchWithin(unit); |
106 if (node is SimpleIdentifier) { | 106 if (node is SimpleIdentifier) { |
107 AstNode parent = node.parent; | 107 AstNode parent = node.parent; |
108 if (parent is InterpolationExpression && parent.rightBracket == null) { | 108 if (parent is InterpolationExpression && parent.rightBracket == null) { |
109 return node; | 109 return node; |
110 } | 110 } |
111 } | 111 } |
112 return null; | 112 return null; |
113 } | 113 } |
114 } | 114 } |
OLD | NEW |