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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart._js_mirrors; 5 library dart._js_mirrors;
6 6
7 import 'shared/runtime_data.dart' as encoding; 7 import 'shared/runtime_data.dart' as encoding;
8 import 'shared/embedded_names.dart' show 8 import 'shared/embedded_names.dart' show
9 ALL_CLASSES, 9 ALL_CLASSES,
10 LAZIES, 10 LAZIES,
(...skipping 30 matching lines...) Expand all
41 TypeVariable, 41 TypeVariable,
42 UnimplementedNoSuchMethodError, 42 UnimplementedNoSuchMethodError,
43 createRuntimeType, 43 createRuntimeType,
44 createUnmangledInvocationMirror, 44 createUnmangledInvocationMirror,
45 getMangledTypeName, 45 getMangledTypeName,
46 getMetadata, 46 getMetadata,
47 getRuntimeType, 47 getRuntimeType,
48 runtimeTypeToString, 48 runtimeTypeToString,
49 setRuntimeTypeInfo, 49 setRuntimeTypeInfo,
50 throwInvalidReflectionError, 50 throwInvalidReflectionError,
51 TypeImpl; 51 TypeImpl,
52 deferredLoadHook;
52 53
53 import 'dart:_interceptors' show 54 import 'dart:_interceptors' show
54 Interceptor, 55 Interceptor,
55 JSArray, 56 JSArray,
56 JSExtendableArray, 57 JSExtendableArray,
57 getInterceptor; 58 getInterceptor;
58 59
59 import 'dart:_js_names'; 60 import 'dart:_js_names';
60 61
61 const String METHODS_WITH_OPTIONAL_ARGUMENTS = r'$methodsWithOptionalArguments'; 62 const String METHODS_WITH_OPTIONAL_ARGUMENTS = r'$methodsWithOptionalArguments';
(...skipping 28 matching lines...) Expand all
90 91
91 final IsolateMirror isolate = new JsIsolateMirror(); 92 final IsolateMirror isolate = new JsIsolateMirror();
92 93
93 JsTypeMirror get dynamicType => _dynamicType; 94 JsTypeMirror get dynamicType => _dynamicType;
94 JsTypeMirror get voidType => _voidType; 95 JsTypeMirror get voidType => _voidType;
95 96
96 static final JsTypeMirror _dynamicType = 97 static final JsTypeMirror _dynamicType =
97 new JsTypeMirror(const Symbol('dynamic')); 98 new JsTypeMirror(const Symbol('dynamic'));
98 static final JsTypeMirror _voidType = new JsTypeMirror(const Symbol('void')); 99 static final JsTypeMirror _voidType = new JsTypeMirror(const Symbol('void'));
99 100
100 static final Map<String, List<LibraryMirror>> librariesByName = 101 static Map<String, List<LibraryMirror>> _librariesByName;
101 computeLibrariesByName(); 102
103 static bool _hasSetDeferredLoadHook = false;
floitsch 2014/09/11 13:25:29 _hasInstalledDeferredLoadHook. Add comment.
sigurdm 2014/09/11 13:54:41 Done.
104
105 static Map<String, List<LibraryMirror>> get librariesByName {
106 if (_librariesByName == null) {
107 _librariesByName = computeLibrariesByName();
108 if (!_hasSetDeferredLoadHook) {
109 _hasSetDeferredLoadHook = true;
110 deferredLoadHook = () => _librariesByName = null;
111 }
112 }
113 return _librariesByName;
114 }
102 115
103 Map<Uri, LibraryMirror> get libraries { 116 Map<Uri, LibraryMirror> get libraries {
104 if (_cachedLibraries != null) return _cachedLibraries; 117 if (_cachedLibraries != null) return _cachedLibraries;
105 Map<Uri, LibraryMirror> result = new Map(); 118 Map<Uri, LibraryMirror> result = new Map();
106 for (List<LibraryMirror> list in librariesByName.values) { 119 for (List<LibraryMirror> list in librariesByName.values) {
107 for (LibraryMirror library in list) { 120 for (LibraryMirror library in list) {
108 result[library.uri] = library; 121 result[library.uri] = library;
109 } 122 }
110 } 123 }
111 return _cachedLibraries = 124 return _cachedLibraries =
(...skipping 2825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 // have a part (following a '.') that starts with '_'. 2950 // have a part (following a '.') that starts with '_'.
2938 const int UNDERSCORE = 0x5f; 2951 const int UNDERSCORE = 0x5f;
2939 if (name.isEmpty) return true; 2952 if (name.isEmpty) return true;
2940 int index = -1; 2953 int index = -1;
2941 do { 2954 do {
2942 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; 2955 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false;
2943 index = name.indexOf('.', index + 1); 2956 index = name.indexOf('.', index + 1);
2944 } while (index >= 0 && index + 1 < name.length); 2957 } while (index >= 0 && index + 1 < name.length);
2945 return true; 2958 return true;
2946 } 2959 }
OLDNEW
« 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