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

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

Issue 1370833002: Remove ElementLocator.locateWithOffset altogether. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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.hover; 5 library computer.hover;
6 6
7 import 'package:analysis_server/src/protocol.dart' show HoverInformation; 7 import 'package:analysis_server/src/protocol.dart' show HoverInformation;
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 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 if (node.parent is ConstructorName && 77 if (node.parent is ConstructorName &&
78 node.parent.parent is InstanceCreationExpression) { 78 node.parent.parent is InstanceCreationExpression) {
79 node = node.parent.parent; 79 node = node.parent.parent;
80 } 80 }
81 if (node is Expression) { 81 if (node is Expression) {
82 Expression expression = node; 82 Expression expression = node;
83 HoverInformation hover = 83 HoverInformation hover =
84 new HoverInformation(expression.offset, expression.length); 84 new HoverInformation(expression.offset, expression.length);
85 // element 85 // element
86 Element element = ElementLocator.locateWithOffset(expression, _offset); 86 Element element = ElementLocator.locate(expression);
87 if (element != null) { 87 if (element != null) {
88 // variable, if synthetic accessor 88 // variable, if synthetic accessor
89 if (element is PropertyAccessorElement) { 89 if (element is PropertyAccessorElement) {
90 PropertyAccessorElement accessor = element; 90 PropertyAccessorElement accessor = element;
91 if (accessor.isSynthetic) { 91 if (accessor.isSynthetic) {
92 element = accessor.variable; 92 element = accessor.variable;
93 } 93 }
94 } 94 }
95 // description 95 // description
96 hover.elementDescription = element.toString(); 96 hover.elementDescription = element.toString();
(...skipping 25 matching lines...) Expand all
122 hover.propagatedType = _safeToString(expression.propagatedType); 122 hover.propagatedType = _safeToString(expression.propagatedType);
123 // done 123 // done
124 return hover; 124 return hover;
125 } 125 }
126 // not an expression 126 // not an expression
127 return null; 127 return null;
128 } 128 }
129 129
130 static _safeToString(obj) => obj != null ? obj.toString() : null; 130 static _safeToString(obj) => obj != null ? obj.toString() : null;
131 } 131 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/edit/edit_domain.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698