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

Unified Diff: pkg/analysis_server/lib/src/computer/computer_hover.dart

Issue 717513003: Issue 21552. Fixes for navigation, hover and rename in instance creation expressions. (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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/computer/computer_hover.dart
diff --git a/pkg/analysis_server/lib/src/computer/computer_hover.dart b/pkg/analysis_server/lib/src/computer/computer_hover.dart
index bab5770d573c8d4725b88fa48401a8b861dbbb12..213f16ed72ad2dfd0af3a19be7bfed93e8abb295 100644
--- a/pkg/analysis_server/lib/src/computer/computer_hover.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_hover.dart
@@ -68,10 +68,21 @@ class DartUnitHoverComputer {
*/
HoverInformation compute() {
AstNode node = new NodeLocator.con1(_offset).searchWithin(_unit);
+ if (node.parent is TypeName &&
+ node.parent.parent is ConstructorName &&
+ node.parent.parent.parent is InstanceCreationExpression) {
+ node = node.parent.parent.parent;
+ }
+ if (node.parent is ConstructorName &&
+ node.parent.parent is InstanceCreationExpression) {
+ node = node.parent.parent;
+ }
if (node is Expression) {
- HoverInformation hover = new HoverInformation(node.offset, node.length);
+ Expression expression = node;
+ HoverInformation hover =
+ new HoverInformation(expression.offset, expression.length);
// element
- Element element = ElementLocator.locateWithOffset(node, _offset);
+ Element element = ElementLocator.locateWithOffset(expression, _offset);
if (element != null) {
// variable, if synthetic accessor
if (element is PropertyAccessorElement) {
@@ -95,10 +106,10 @@ class DartUnitHoverComputer {
hover.dartdoc = dartDoc;
}
// parameter
- hover.parameter = _safeToString(node.bestParameterElement);
+ hover.parameter = _safeToString(expression.bestParameterElement);
// types
- hover.staticType = _safeToString(node.staticType);
- hover.propagatedType = _safeToString(node.propagatedType);
+ hover.staticType = _safeToString(expression.staticType);
+ hover.propagatedType = _safeToString(expression.propagatedType);
// done
return hover;
}

Powered by Google App Engine
This is Rietveld 408576698