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

Unified Diff: pkg/analyzer/lib/src/generated/static_type_analyzer.dart

Issue 1021773002: Fix static type analysis of function invocation expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/static_type_analyzer.dart
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index 0e907624c74b0fe23094623b0f1e376c249566db..3f38498cdacde08770f4b4f316159012ad132f37 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -390,25 +390,18 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
*/
@override
Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
- ExecutableElement staticMethodElement = node.staticElement;
- // Record static return type of the static element.
- DartType staticStaticType = _computeStaticReturnType(staticMethodElement);
- _recordStaticType(node, staticStaticType);
- // Record propagated return type of the static element.
- DartType staticPropagatedType =
- _computePropagatedReturnType(staticMethodElement);
- _recordPropagatedTypeIfBetter(node, staticPropagatedType);
- // Process propagated element.
- ExecutableElement propagatedMethodElement = node.propagatedElement;
- if (!identical(propagatedMethodElement, staticMethodElement)) {
- // Record static return type of the propagated element.
- DartType propagatedStaticType =
- _computeStaticReturnType(propagatedMethodElement);
- _recordPropagatedTypeIfBetter(node, propagatedStaticType, true);
- // Record propagated return type of the propagated element.
- DartType propagatedPropagatedType =
- _computePropagatedReturnType(propagatedMethodElement);
- _recordPropagatedTypeIfBetter(node, propagatedPropagatedType, true);
+ DartType functionStaticType = _getStaticType(node.function);
+ DartType staticType;
+ if (functionStaticType is FunctionType) {
+ staticType = functionStaticType.returnType;
+ } else {
+ staticType = _dynamicType;
+ }
+ _recordStaticType(node, staticType);
+ DartType functionPropagatedType = node.function.propagatedType;
+ if (functionPropagatedType is FunctionType) {
+ DartType propagatedType = functionPropagatedType.returnType;
+ _recordPropagatedTypeIfBetter(node, propagatedType);
}
return null;
}
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698