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

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

Issue 661193004: Issue 21419. Don't create navigation region for elements without location. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« 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 'package:analysis_server/src/protocol_server.dart' as protocol; 7 import 'package:analysis_server/src/protocol_server.dart' as protocol;
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/element.dart'; 9 import 'package:analyzer/src/generated/element.dart';
10 import 'package:analyzer/src/generated/scanner.dart'; 10 import 'package:analyzer/src/generated/scanner.dart';
(...skipping 18 matching lines...) Expand all
29 return new List.from(_regions); 29 return new List.from(_regions);
30 } 30 }
31 31
32 void _addRegion(int offset, int length, Element element) { 32 void _addRegion(int offset, int length, Element element) {
33 if (element is FieldFormalParameterElement) { 33 if (element is FieldFormalParameterElement) {
34 element = (element as FieldFormalParameterElement).field; 34 element = (element as FieldFormalParameterElement).field;
35 } 35 }
36 if (element == null || element == DynamicElementImpl.instance) { 36 if (element == null || element == DynamicElementImpl.instance) {
37 return; 37 return;
38 } 38 }
39 if (element.location == null) {
40 return;
41 }
39 protocol.Element target = protocol.newElement_fromEngine(element); 42 protocol.Element target = protocol.newElement_fromEngine(element);
40 _regions.add(new protocol.NavigationRegion(offset, length, [target])); 43 _regions.add(new protocol.NavigationRegion(offset, length, [target]));
41 } 44 }
42 45
43 void _addRegion_nodeStart_nodeEnd(AstNode a, AstNode b, Element element) { 46 void _addRegion_nodeStart_nodeEnd(AstNode a, AstNode b, Element element) {
44 int offset = a.offset; 47 int offset = a.offset;
45 int length = b.end - offset; 48 int length = b.end - offset;
46 _addRegion(offset, length, element); 49 _addRegion(offset, length, element);
47 } 50 }
48 51
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 Element element = node.bestElement; 229 Element element = node.bestElement;
227 computer._addRegionForNode(node, element); 230 computer._addRegionForNode(node, element);
228 } 231 }
229 232
230 void _safelyVisit(AstNode node) { 233 void _safelyVisit(AstNode node) {
231 if (node != null) { 234 if (node != null) {
232 node.accept(this); 235 node.accept(this);
233 } 236 }
234 } 237 }
235 } 238 }
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