OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 domains.analysis.navigation_dart; | 5 library domains.analysis.navigation_dart; |
6 | 6 |
7 import 'package:analysis_server/analysis/navigation_core.dart'; | 7 import 'package:analysis_server/analysis/navigation_core.dart'; |
8 import 'package:analysis_server/src/protocol_server.dart' as protocol; | 8 import 'package:analysis_server/src/protocol_server.dart' as protocol; |
9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 130 } |
131 | 131 |
132 @override | 132 @override |
133 visitPartDirective(PartDirective node) { | 133 visitPartDirective(PartDirective node) { |
134 _addUriDirectiveRegion(node, node.element); | 134 _addUriDirectiveRegion(node, node.element); |
135 super.visitPartDirective(node); | 135 super.visitPartDirective(node); |
136 } | 136 } |
137 | 137 |
138 @override | 138 @override |
139 visitPartOfDirective(PartOfDirective node) { | 139 visitPartOfDirective(PartOfDirective node) { |
140 computer._addRegion_tokenStart_nodeEnd( | 140 computer._addRegionForNode(node.libraryName, node.element); |
141 node.keyword, node.libraryName, node.element); | |
142 super.visitPartOfDirective(node); | 141 super.visitPartOfDirective(node); |
143 } | 142 } |
144 | 143 |
145 @override | 144 @override |
146 visitPostfixExpression(PostfixExpression node) { | 145 visitPostfixExpression(PostfixExpression node) { |
147 super.visitPostfixExpression(node); | 146 super.visitPostfixExpression(node); |
148 computer._addRegionForToken(node.operator, node.bestElement); | 147 computer._addRegionForToken(node.operator, node.bestElement); |
149 } | 148 } |
150 | 149 |
151 @override | 150 @override |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 248 } |
250 collector.addRegion(offset, length, kind, location); | 249 collector.addRegion(offset, length, kind, location); |
251 } | 250 } |
252 | 251 |
253 void _addRegion_nodeStart_nodeEnd(AstNode a, AstNode b, Element element) { | 252 void _addRegion_nodeStart_nodeEnd(AstNode a, AstNode b, Element element) { |
254 int offset = a.offset; | 253 int offset = a.offset; |
255 int length = b.end - offset; | 254 int length = b.end - offset; |
256 _addRegion(offset, length, element); | 255 _addRegion(offset, length, element); |
257 } | 256 } |
258 | 257 |
259 void _addRegion_tokenStart_nodeEnd(Token a, AstNode b, Element element) { | |
260 int offset = a.offset; | |
261 int length = b.end - offset; | |
262 _addRegion(offset, length, element); | |
263 } | |
264 | |
265 void _addRegionForNode(AstNode node, Element element) { | 258 void _addRegionForNode(AstNode node, Element element) { |
266 int offset = node.offset; | 259 int offset = node.offset; |
267 int length = node.length; | 260 int length = node.length; |
268 _addRegion(offset, length, element); | 261 _addRegion(offset, length, element); |
269 } | 262 } |
270 | 263 |
271 void _addRegionForToken(Token token, Element element) { | 264 void _addRegionForToken(Token token, Element element) { |
272 int offset = token.offset; | 265 int offset = token.offset; |
273 int length = token.length; | 266 int length = token.length; |
274 _addRegion(offset, length, element); | 267 _addRegion(offset, length, element); |
(...skipping 27 matching lines...) Expand all Loading... |
302 } | 295 } |
303 // The node starts or ends in the range. | 296 // The node starts or ends in the range. |
304 if (isInRange(node.offset) || isInRange(node.end)) { | 297 if (isInRange(node.offset) || isInRange(node.end)) { |
305 node.accept(visitor); | 298 node.accept(visitor); |
306 return; | 299 return; |
307 } | 300 } |
308 // Go deeper. | 301 // Go deeper. |
309 super.visitNode(node); | 302 super.visitNode(node); |
310 } | 303 } |
311 } | 304 } |
OLD | NEW |