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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 19496003: Make ClassMirror.members 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 25346)
+++ runtime/lib/mirrors_impl.dart (working copy)
@@ -19,6 +19,12 @@
return new_map;
}
+Map _makeMemberMap(List mirrors) {
+ Map<Symbol, dynamic> result = new Map();
ahe 2013/07/24 10:11:54 I think it is more important to have the type on t
+ mirrors.forEach((mirror) => result[mirror.simpleName] = mirror);
+ return result;
+}
+
String _n(Symbol symbol) => _symbol_dev.Symbol.getName(symbol);
Symbol _s(String name) {
@@ -394,11 +400,9 @@
this._superclass,
this._superinterfaces,
this._defaultFactory,
- Map<String, Mirror> members,
Map<String, Mirror> constructors,
Map<String, Mirror> typeVariables)
: this._simpleName = _s(simpleName),
- this.members = _convertStringToSymbolMap(members),
this.constructors = _convertStringToSymbolMap(constructors),
this.typeVariables = _convertStringToSymbolMap(typeVariables),
super(reflectee);
@@ -472,8 +476,15 @@
return _defaultFactory;
}
- final Map<Symbol, Mirror> members;
+ Map<Symbol, Mirror> _members;
+ Map<Symbol, Mirror> get members {
+ if (_members == null) {
+ _members = _makeMemberMap(_computeMembers(_reflectee));
+ }
+ return _members;
+ }
+
Map<Symbol, MethodMirror> _methods = null;
Map<Symbol, MethodMirror> _getters = null;
Map<Symbol, MethodMirror> _setters = null;
@@ -580,6 +591,9 @@
static _library(reflectee)
native "ClassMirror_library";
+ _computeMembers(reflectee)
+ native "ClassMirror_members";
+
_invoke(reflectee, memberName, positionalArguments)
native 'ClassMirror_invoke';
@@ -619,9 +633,10 @@
[ new _LazyTypeMirror('dart:core', 'Function') ],
null,
const {},
- const {},
const {});
+ Map<Symbol, Mirror> get members => const {};
ahe 2013/07/24 10:11:54 Add type arguments.
+
var _returnType;
TypeMirror get returnType {
if (_returnType is! Mirror) {
« 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