Index: lib/src/checker/rules.dart |
diff --git a/lib/src/checker/rules.dart b/lib/src/checker/rules.dart |
index ef09d3b871cb37a522590947b52d22e2cb31f900..b1d313b585b7bd689c4ed652216a824dd6872201 100644 |
--- a/lib/src/checker/rules.dart |
+++ b/lib/src/checker/rules.dart |
@@ -44,7 +44,7 @@ abstract class TypeRules { |
bool isDynamic(DartType t); |
bool isDynamicTarget(Expression expr); |
- bool isDynamicGet(Expression expr); |
+ bool isDynamicGet(Expression target, SimpleIdentifier name); |
bool isDynamicCall(Expression call); |
} |
@@ -75,7 +75,7 @@ class DartRules extends TypeRules { |
/// By default, all invocations are dynamic in Dart. |
bool isDynamic(DartType t) => true; |
bool isDynamicTarget(Expression expr) => true; |
- bool isDynamicGet(Expression expr) => true; |
+ bool isDynamicGet(Expression target, SimpleIdentifier name) => true; |
bool isDynamicCall(Expression call) => true; |
} |
@@ -530,9 +530,10 @@ class RestrictedRules extends TypeRules { |
/// Returns `true` if the expression is a dynamic property access or prefixed |
/// identifier. |
- bool isDynamicGet(Expression expr) { |
+ bool isDynamicGet(Expression target, SimpleIdentifier name) { |
if (options.ignoreTypes) return true; |
- var t = getStaticType(expr); |
+ if (!name.staticType.isDynamic) return false; |
+ var t = getStaticType(target); |
// TODO(jmesserly): we should not allow all property gets on `Function` |
return t.isDynamic || t.isDartCoreFunction; |
} |