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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 20119002: Make LibraryMirror.members an internal native and lazy. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors_impl.dart
===================================================================
--- runtime/lib/mirrors_impl.dart (revision 25450)
+++ runtime/lib/mirrors_impl.dart (working copy)
@@ -793,10 +793,8 @@
implements LibraryMirror {
_LocalLibraryMirrorImpl(reflectee,
String simpleName,
- String url,
- Map<String, Mirror> members)
+ String url)
: this.simpleName = _s(simpleName),
- this.members = _convertStringToSymbolMap(members),
this.uri = Uri.parse(url),
super(reflectee);
@@ -820,8 +818,16 @@
}
final Uri uri;
- final Map<Symbol, Mirror> members;
+ Map<Symbol, Mirror> _members;
+
+ Map<Symbol, Mirror> get members {
+ if (_members == null) {
+ _members = _makeMemberMap(_computeMembers(_reflectee));
+ }
+ return _members;
ahe 2013/07/25 08:27:19 You need to return something that is immutable. _
rmacnak 2013/07/25 16:31:09 Yeah, we're holding the status quo here.
+ }
+
Map<Symbol, ClassMirror> _classes = null;
Map<Symbol, MethodMirror> _functions = null;
Map<Symbol, MethodMirror> _getters = null;
@@ -884,6 +890,9 @@
_invokeSetter(reflectee, setterName, value)
native 'LibraryMirror_invokeSetter';
+
+ _computeMembers(reflectee)
+ native "LibraryMirror_members";
}
class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698