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

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

Issue 562853002: Recompute librariesByName after loading a deferred library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 6 years, 3 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: sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart b/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
index 3ff978985ee12103d4ce7d14321962885c4c89b2..60e8add0393e77c9aa7cb9381b07e55b42090745 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
@@ -48,7 +48,8 @@ import 'dart:_js_helper' show
runtimeTypeToString,
setRuntimeTypeInfo,
throwInvalidReflectionError,
- TypeImpl;
+ TypeImpl,
+ deferredLoadHook;
import 'dart:_interceptors' show
Interceptor,
@@ -97,8 +98,20 @@ class JsMirrorSystem implements MirrorSystem {
new JsTypeMirror(const Symbol('dynamic'));
static final JsTypeMirror _voidType = new JsTypeMirror(const Symbol('void'));
- static final Map<String, List<LibraryMirror>> librariesByName =
- computeLibrariesByName();
+ static Map<String, List<LibraryMirror>> _librariesByName;
+
+ static bool _hasSetDeferredLoadHook = false;
floitsch 2014/09/11 13:25:29 _hasInstalledDeferredLoadHook. Add comment.
sigurdm 2014/09/11 13:54:41 Done.
+
+ static Map<String, List<LibraryMirror>> get librariesByName {
+ if (_librariesByName == null) {
+ _librariesByName = computeLibrariesByName();
+ if (!_hasSetDeferredLoadHook) {
+ _hasSetDeferredLoadHook = true;
+ deferredLoadHook = () => _librariesByName = null;
+ }
+ }
+ return _librariesByName;
+ }
Map<Uri, LibraryMirror> get libraries {
if (_cachedLibraries != null) return _cachedLibraries;
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/js_helper.dart ('k') | tests/lib/mirrors/deferred_mirrors_update_lib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698