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

Unified Diff: dart/sdk/lib/_internal/lib/js_mirrors.dart

Issue 19575004: Implement accessing lazily initialized static fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
Index: dart/sdk/lib/_internal/lib/js_mirrors.dart
diff --git a/dart/sdk/lib/_internal/lib/js_mirrors.dart b/dart/sdk/lib/_internal/lib/js_mirrors.dart
index 7b84eab5e1566961b80aefe6dd15fd45787c55b4..802ec36be2936060d4a50404c1e7d2077d9d2cde 100644
--- a/dart/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/dart/sdk/lib/_internal/lib/js_mirrors.dart
@@ -633,7 +633,12 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
if (!JS('bool', '# in #', jsName, JS_CURRENT_ISOLATE())) {
throw new RuntimeError('Cannot find "$jsName" in current isolate.');
}
- return reflect(JS('', '#[#]', JS_CURRENT_ISOLATE(), jsName));
+ if (JS('bool', '# in init.lazies', jsName)) {
+ String getterName = JS('String', 'init.lazies[#]', jsName);
+ return reflect(JS('', '#[#]()', JS_CURRENT_ISOLATE(), getterName));
+ } else {
+ return reflect(JS('', '#[#]', JS_CURRENT_ISOLATE(), jsName));
+ }
}
// TODO(ahe): What receiver to use?
throw new NoSuchMethodError(this, n(fieldName), null, null);
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart ('k') | dart/tests/lib/mirrors/lazy_static_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698