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

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

Issue 438753002: Ignore 'dynamic' and 'void' elements in the occurrences computer too. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | 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.occurrences; 5 library computer.occurrences;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analysis_server/src/computer/element.dart' as server; 9 import 'package:analysis_server/src/computer/element.dart' as server;
10 import 'package:analysis_services/constants.dart'; 10 import 'package:analysis_services/constants.dart';
(...skipping 21 matching lines...) Expand all
32 List<Occurrences> occurrences = <Occurrences>[]; 32 List<Occurrences> occurrences = <Occurrences>[];
33 _elementsOffsets.forEach((engineElement, offsets) { 33 _elementsOffsets.forEach((engineElement, offsets) {
34 var serverElement = new server.Element.fromEngine(engineElement); 34 var serverElement = new server.Element.fromEngine(engineElement);
35 var length = engineElement.displayName.length; 35 var length = engineElement.displayName.length;
36 occurrences.add(new Occurrences(serverElement, offsets, length)); 36 occurrences.add(new Occurrences(serverElement, offsets, length));
37 }); 37 });
38 return occurrences; 38 return occurrences;
39 } 39 }
40 40
41 void _addOccurrence(Element element, int offset) { 41 void _addOccurrence(Element element, int offset) {
42 if (element == null || element == DynamicElementImpl.instance) {
43 return;
44 }
42 element = _canonicalizeElement(element); 45 element = _canonicalizeElement(element);
43 List<int> offsets = _elementsOffsets[element]; 46 List<int> offsets = _elementsOffsets[element];
44 if (offsets == null) { 47 if (offsets == null) {
45 offsets = <int>[]; 48 offsets = <int>[];
46 _elementsOffsets[element] = offsets; 49 _elementsOffsets[element] = offsets;
47 } 50 }
48 offsets.add(offset); 51 offsets.add(offset);
49 } 52 }
50 53
51 Element _canonicalizeElement(Element element) { 54 Element _canonicalizeElement(Element element) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 100
98 @override 101 @override
99 visitSimpleIdentifier(SimpleIdentifier node) { 102 visitSimpleIdentifier(SimpleIdentifier node) {
100 Element element = node.bestElement; 103 Element element = node.bestElement;
101 if (element != null) { 104 if (element != null) {
102 computer._addOccurrence(element, node.offset); 105 computer._addOccurrence(element, node.offset);
103 } 106 }
104 return super.visitSimpleIdentifier(node); 107 return super.visitSimpleIdentifier(node);
105 } 108 }
106 } 109 }
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