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

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: 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 librariesUpdatedHook;
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 Map<String, List<LibraryMirror>> get librariesByName {
104 if (_librariesByName == null) {
105 _librariesByName = computeLibrariesByName();
106 librariesUpdatedHook = () => _librariesByName = computeLibrariesByName();
floitsch 2014/09/11 09:01:27 () => _librariesByName = null. When there are sev
sigurdm 2014/09/11 12:06:44 Done.
107 }
108 return _librariesByName;
109 }
102 110
103 Map<Uri, LibraryMirror> get libraries { 111 Map<Uri, LibraryMirror> get libraries {
104 if (_cachedLibraries != null) return _cachedLibraries; 112 if (_cachedLibraries != null) return _cachedLibraries;
105 Map<Uri, LibraryMirror> result = new Map(); 113 Map<Uri, LibraryMirror> result = new Map();
106 for (List<LibraryMirror> list in librariesByName.values) { 114 for (List<LibraryMirror> list in librariesByName.values) {
107 for (LibraryMirror library in list) { 115 for (LibraryMirror library in list) {
108 result[library.uri] = library; 116 result[library.uri] = library;
109 } 117 }
110 } 118 }
111 return _cachedLibraries = 119 return _cachedLibraries =
(...skipping 2825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 // have a part (following a '.') that starts with '_'. 2945 // have a part (following a '.') that starts with '_'.
2938 const int UNDERSCORE = 0x5f; 2946 const int UNDERSCORE = 0x5f;
2939 if (name.isEmpty) return true; 2947 if (name.isEmpty) return true;
2940 int index = -1; 2948 int index = -1;
2941 do { 2949 do {
2942 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; 2950 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false;
2943 index = name.indexOf('.', index + 1); 2951 index = name.indexOf('.', index + 1);
2944 } while (index >= 0 && index + 1 < name.length); 2952 } while (index >= 0 && index + 1 < name.length);
2945 return true; 2953 return true;
2946 } 2954 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698