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

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

Issue 1814893002: Issue 25945. Include static/propagateInvokeType for MethodInvocation names into hover. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/get_hover_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19ae943aea8a5fc5159b7681b78bfbd2104090f2..33b59410cd74c3ea78a43b64060d58101fbea115 100644
--- a/pkg/analysis_server/lib/src/computer/computer_hover.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_hover.dart
@@ -10,6 +10,7 @@ import 'package:analysis_server/src/computer/computer_overrides.dart';
import 'package:analysis_server/src/utilities/documentation.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
/**
@@ -76,10 +77,26 @@ class DartUnitHoverComputer {
// parameter
hover.parameter = _safeToString(expression.bestParameterElement);
// types
- if (element == null || element is VariableElement) {
- hover.staticType = _safeToString(expression.staticType);
+ {
+ AstNode parent = expression.parent;
+ DartType staticType = null;
+ DartType propagatedType = expression.propagatedType;
+ if (element == null || element is VariableElement) {
+ staticType = expression.staticType;
+ }
+ if (parent is MethodInvocation && parent.methodName == expression) {
+ staticType = parent.staticInvokeType;
+ propagatedType = parent.propagatedInvokeType;
+ if (staticType != null && staticType.isDynamic) {
+ staticType = null;
+ }
+ if (propagatedType != null && propagatedType.isDynamic) {
+ propagatedType = null;
+ }
+ }
+ hover.staticType = _safeToString(staticType);
+ hover.propagatedType = _safeToString(propagatedType);
}
- hover.propagatedType = _safeToString(expression.propagatedType);
// done
return hover;
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/get_hover_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698