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

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

Issue 433973003: Ignore 'dynamic' in the navigation computer. (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.navigation; 5 library computer.navigation;
6 6
7 import 'package:analysis_services/constants.dart'; 7 import 'package:analysis_services/constants.dart';
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 13 matching lines...) Expand all
24 24
25 /** 25 /**
26 * Returns the computed navigation regions, not `null`. 26 * Returns the computed navigation regions, not `null`.
27 */ 27 */
28 List<Map<String, Object>> compute() { 28 List<Map<String, Object>> compute() {
29 _unit.accept(new _DartUnitNavigationComputerVisitor(this)); 29 _unit.accept(new _DartUnitNavigationComputerVisitor(this));
30 return new List.from(_regions); 30 return new List.from(_regions);
31 } 31 }
32 32
33 void _addRegion(int offset, int length, Element element) { 33 void _addRegion(int offset, int length, Element element) {
34 if (element == null) { 34 if (element == null || element == DynamicElementImpl.instance) {
35 return; 35 return;
36 } 36 }
37 if (element is FieldFormalParameterElement) { 37 if (element is FieldFormalParameterElement) {
38 element = (element as FieldFormalParameterElement).field; 38 element = (element as FieldFormalParameterElement).field;
39 } 39 }
40 var elementJson = new computer.Element.fromEngine(element).toJson(); 40 var elementJson = new computer.Element.fromEngine(element).toJson();
41 _regions.add({ 41 _regions.add({
42 OFFSET: offset, 42 OFFSET: offset,
43 LENGTH: length, 43 LENGTH: length,
44 TARGETS: [elementJson] 44 TARGETS: [elementJson]
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 @override 97 @override
98 visitConstructorDeclaration(ConstructorDeclaration node) { 98 visitConstructorDeclaration(ConstructorDeclaration node) {
99 // associate constructor with "T" or "T.name" 99 // associate constructor with "T" or "T.name"
100 { 100 {
101 AstNode firstNode = node.returnType; 101 AstNode firstNode = node.returnType;
102 AstNode lastNode = node.name; 102 AstNode lastNode = node.name;
103 if (lastNode == null) { 103 if (lastNode == null) {
104 lastNode = firstNode; 104 lastNode = firstNode;
105 } 105 }
106 if (firstNode != null && lastNode != null) { 106 if (firstNode != null && lastNode != null) {
107 computer._addRegion_nodeStart_nodeEnd(firstNode, lastNode, 107 computer._addRegion_nodeStart_nodeEnd(
108 firstNode,
109 lastNode,
108 node.element); 110 node.element);
109 } 111 }
110 } 112 }
111 return super.visitConstructorDeclaration(node); 113 return super.visitConstructorDeclaration(node);
112 } 114 }
113 115
114 @override 116 @override
115 visitExportDirective(ExportDirective node) { 117 visitExportDirective(ExportDirective node) {
116 ExportElement exportElement = node.element; 118 ExportElement exportElement = node.element;
117 if (exportElement != null) { 119 if (exportElement != null) {
(...skipping 24 matching lines...) Expand all
142 Element element = node.staticElement; 144 Element element = node.staticElement;
143 if (element != null && element.isSynthetic) { 145 if (element != null && element.isSynthetic) {
144 element = element.enclosingElement; 146 element = element.enclosingElement;
145 } 147 }
146 computer._addRegion_nodeStart_nodeStart(node, node.argumentList, element); 148 computer._addRegion_nodeStart_nodeStart(node, node.argumentList, element);
147 return super.visitInstanceCreationExpression(node); 149 return super.visitInstanceCreationExpression(node);
148 } 150 }
149 151
150 @override 152 @override
151 visitPartDirective(PartDirective node) { 153 visitPartDirective(PartDirective node) {
152 computer._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, 154 computer._addRegion_tokenStart_nodeEnd(
155 node.keyword,
156 node.uri,
153 node.element); 157 node.element);
154 return super.visitPartDirective(node); 158 return super.visitPartDirective(node);
155 } 159 }
156 160
157 @override 161 @override
158 visitPartOfDirective(PartOfDirective node) { 162 visitPartOfDirective(PartOfDirective node) {
159 computer._addRegion_tokenStart_nodeEnd(node.keyword, node.libraryName, 163 computer._addRegion_tokenStart_nodeEnd(
164 node.keyword,
165 node.libraryName,
160 node.element); 166 node.element);
161 return super.visitPartOfDirective(node); 167 return super.visitPartOfDirective(node);
162 } 168 }
163 169
164 @override 170 @override
165 visitPostfixExpression(PostfixExpression node) { 171 visitPostfixExpression(PostfixExpression node) {
166 computer._addRegionForToken(node.operator, node.bestElement); 172 computer._addRegionForToken(node.operator, node.bestElement);
167 return super.visitPostfixExpression(node); 173 return super.visitPostfixExpression(node);
168 } 174 }
169 175
170 @override 176 @override
171 visitPrefixExpression(PrefixExpression node) { 177 visitPrefixExpression(PrefixExpression node) {
172 computer._addRegionForToken(node.operator, node.bestElement); 178 computer._addRegionForToken(node.operator, node.bestElement);
173 return super.visitPrefixExpression(node); 179 return super.visitPrefixExpression(node);
174 } 180 }
175 181
176 @override 182 @override
177 visitSimpleIdentifier(SimpleIdentifier node) { 183 visitSimpleIdentifier(SimpleIdentifier node) {
178 if (node.parent is ConstructorDeclaration) { 184 if (node.parent is ConstructorDeclaration) {
179 } else { 185 } else {
180 computer._addRegionForNode(node, node.bestElement); 186 computer._addRegionForNode(node, node.bestElement);
181 } 187 }
182 return super.visitSimpleIdentifier(node); 188 return super.visitSimpleIdentifier(node);
183 } 189 }
184 } 190 }
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