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

Unified Diff: lib/src/checker/rules.dart

Issue 1055923002: Don't call dinvoke on Object methods (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix for sealed types Created 5 years, 8 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: 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;
}

Powered by Google App Engine
This is Rietveld 408576698