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

Unified Diff: pkg/analyzer/lib/src/task/strong/checker.dart

Issue 2212233003: fix #26393, treat tear offs as definite functions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: remove comment Created 4 years, 4 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
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 b20d702e71f4f1c4fa53b9c4974e48b22260857e..8b21d95a2b41217eaf79f90c223b0bdc87948988 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -21,7 +21,7 @@ import 'package:analyzer/src/generated/type_system.dart';
import 'ast_properties.dart';
-bool isKnownFunction(Expression expression, {bool instanceMethods: false}) {
+bool isKnownFunction(Expression expression) {
Element element = null;
if (expression is ParenthesizedExpression) {
expression = (expression as ParenthesizedExpression).expression;
@@ -36,7 +36,7 @@ bool isKnownFunction(Expression expression, {bool instanceMethods: false}) {
// 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 && (instanceMethods || element.isStatic);
+ element is MethodElement;
}
DartType _elementType(Element e) {
@@ -1004,7 +1004,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 (isKnownFunction(call, instanceMethods: true)) {
+ if (isKnownFunction(call)) {
return false;
}
return rules.anyParameterType(ft, (pt) => pt.isDynamic);

Powered by Google App Engine
This is Rietveld 408576698