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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 1247733005: Fix getField optimization when the selector is an operator. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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 | tests/lib/mirrors/hot_get_field_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors_impl.dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index 2e55bfd844d1d2d303e33c017d11090abcd0089a..c64be5de39f23c626b4a5bbd806b34335d96d1ad 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -447,11 +447,16 @@ class _LocalInstanceMirror extends _LocalObjectMirror
var result = reflect(_invokeGetter(_reflectee, unwrapped));
// Wait until success to avoid creating closures for non-existent getters,
// and defer the creation until the next getField invocation.
- _getFieldClosures[unwrapped] = (receiver) {
- var getterClosure = _createGetterClosure(unwrapped);
- _getFieldClosures[unwrapped] = getterClosure;
- return getterClosure(receiver);
- };
+ // o.<operator> is not valid Dart and will cause a compilation error, so
+ // don't attempt to generate such a closure.
+ bool isOperator = _LocalMethodMirror._operators.contains(unwrapped);
+ if (!isOperator) {
+ _getFieldClosures[unwrapped] = (receiver) {
+ var getterClosure = _createGetterClosure(unwrapped);
+ _getFieldClosures[unwrapped] = getterClosure;
+ return getterClosure(receiver);
+ };
+ }
return result;
}
« no previous file with comments | « no previous file | tests/lib/mirrors/hot_get_field_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698