Chromium Code Reviews| Index: pkg/analyzer/lib/src/task/strong/checker.dart |
| diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart |
| index 7ccdcc97f08140025a5d11887d1ff2b5cd580aac..4146098de282e63915e4bbb1edf11f6997432549 100644 |
| --- a/pkg/analyzer/lib/src/task/strong/checker.dart |
| +++ b/pkg/analyzer/lib/src/task/strong/checker.dart |
| @@ -36,21 +36,13 @@ DartType getDefiniteType( |
| DartType type = expression.staticType ?? DynamicTypeImpl.instance; |
| if (typeSystem is StrongTypeSystemImpl && |
| type is FunctionType && |
| - _hasStrictArrow(expression)) { |
| + hasStrictArrow(expression)) { |
| // Remove fuzzy arrow if possible. |
| return typeSystem.functionTypeToConcreteType(type); |
| } |
| return type; |
| } |
| -bool isKnownFunction(Expression expression) { |
| - var element = _getKnownElement(expression); |
| - // First class functions and static methods, where we know the original |
| - // declaration, will have an exact type, so we know a downcast will fail. |
| - return element is FunctionElement || |
| - element is MethodElement && element.isStatic; |
| -} |
| - |
| DartType _elementType(Element e) { |
| if (e == null) { |
| // Malformed code - just return dynamic. |
| @@ -105,7 +97,7 @@ FieldElement _getMemberField( |
| FunctionType _getMemberType(InterfaceType type, ExecutableElement member) => |
| _memberTypeGetter(member)(type); |
| -bool _hasStrictArrow(Expression expression) { |
| +bool hasStrictArrow(Expression expression) { |
| var element = _getKnownElement(expression); |
| return element is FunctionElement || element is MethodElement; |
| } |
| @@ -1002,7 +994,7 @@ class CodeChecker extends RecursiveAstVisitor { |
| // a dynamic parameter type requires a dynamic call in general. |
| // However, as an optimization, if we have an original definition, we know |
| // dynamic is reified as Object - in this case a regular call is fine. |
| - if (_hasStrictArrow(call.function)) { |
| + if (hasStrictArrow(call.function)) { |
| return false; |
| } |
| return rules.anyParameterType(ft, (pt) => pt.isDynamic); |
| @@ -1090,7 +1082,7 @@ class CodeChecker extends RecursiveAstVisitor { |
| } |
| } |
| - if (isKnownFunction(expr)) { |
| + if (hasStrictArrow(expr)) { |
|
Leaf
2017/02/03 20:28:41
This needs to stay isKnownFunction (see my comment
|
| Element e = _getKnownElement(expr); |
| _recordMessage( |
| expr, |