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

Side by Side Diff: pkg/analysis_server/lib/src/computer/computer_navigation.dart

Issue 1218183007: Change navigation regions generation for constructors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/notification_navigation_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 computer.navigation; 5 library computer.navigation;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analysis_server/src/protocol_server.dart' as protocol; 9 import 'package:analysis_server/src/protocol_server.dart' as protocol;
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 Element element = node.staticElement; 239 Element element = node.staticElement;
240 if (element == null) { 240 if (element == null) {
241 return; 241 return;
242 } 242 }
243 // if a synthetic constructor, navigate to the class 243 // if a synthetic constructor, navigate to the class
244 if (element.isSynthetic) { 244 if (element.isSynthetic) {
245 element = element.enclosingElement; 245 element = element.enclosingElement;
246 } 246 }
247 // add regions 247 // add regions
248 TypeName typeName = node.type; 248 TypeName typeName = node.type;
249 computer._addRegionForNode(typeName.name, element);
250 // <TypeA, TypeB>
249 TypeArgumentList typeArguments = typeName.typeArguments; 251 TypeArgumentList typeArguments = typeName.typeArguments;
250 if (typeArguments == null) { 252 if (typeArguments != null) {
251 computer._addRegion_nodeStart_nodeEnd(parent, node, element);
252 } else {
253 computer._addRegion_nodeStart_nodeEnd(parent, typeName.name, element);
254 // <TypeA, TypeB>
255 typeArguments.accept(this); 253 typeArguments.accept(this);
256 // optional ".name" 254 }
257 if (node.period != null) { 255 // optional "name"
258 computer._addRegion_tokenStart_nodeEnd(node.period, node, element); 256 if (node.name != null) {
259 } 257 computer._addRegionForNode(node.name, element);
260 } 258 }
261 } 259 }
262 260
263 /** 261 /**
264 * If the source of the given [element] (referenced by the [node]) exists, 262 * If the source of the given [element] (referenced by the [node]) exists,
265 * then add the navigation region from the [node] to the [element]. 263 * then add the navigation region from the [node] to the [element].
266 */ 264 */
267 void _addUriDirectiveRegion(UriBasedDirective node, Element element) { 265 void _addUriDirectiveRegion(UriBasedDirective node, Element element) {
268 if (element != null) { 266 if (element != null) {
269 Source source = element.source; 267 Source source = element.source;
270 if (element.context.exists(source)) { 268 if (element.context.exists(source)) {
271 computer._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, element); 269 computer._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, element);
272 } 270 }
273 } 271 }
274 } 272 }
275 273
276 void _safelyVisit(AstNode node) { 274 void _safelyVisit(AstNode node) {
277 if (node != null) { 275 if (node != null) {
278 node.accept(this); 276 node.accept(this);
279 } 277 }
280 } 278 }
281 } 279 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/notification_navigation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698