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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 18465006: Add a MirrorReference reflectee for ClassMirrors. Rewrite the name accessor in terms of it, at leas… (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 24825)
+++ runtime/lib/mirrors_impl.dart (working copy)
@@ -83,13 +83,17 @@
final Map<Uri, LibraryMirror> libraries;
final IsolateMirror isolate;
+ // TODO(11743): dynamicType and voidType should not respond to the
+ // ClassMirror protocol, so they should not inherit from the ClassMirror
+ // implementation.
+
TypeMirror _dynamicType = null;
TypeMirror get dynamicType {
if (_dynamicType == null) {
_dynamicType =
new _LocalClassMirrorImpl(
- null, 'dynamic', false, null, null, [], null,
+ null, null, 'dynamic', false, null, null, [], null,
const {}, const {}, const {});
}
return _dynamicType;
@@ -101,7 +105,7 @@
if (_voidType == null) {
_voidType =
new _LocalClassMirrorImpl(
- null, 'void', false, null, null, [], null,
+ null, null, 'void', false, null, null, [], null,
const {}, const {}, const {});
}
return _voidType;
@@ -376,7 +380,8 @@
class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
implements ClassMirror {
- _LocalClassMirrorImpl(ref,
+ _LocalClassMirrorImpl(this._reflectee,
+ ref,
String simpleName,
this.isClass,
this._owner,
@@ -386,14 +391,24 @@
Map<String, Mirror> members,
Map<String, Mirror> constructors,
Map<String, Mirror> typeVariables)
- : this.simpleName = _s(simpleName),
+ : this._simpleName = _s(simpleName),
this.members = _convertStringToSymbolMap(members),
this.constructors = _convertStringToSymbolMap(constructors),
this.typeVariables = _convertStringToSymbolMap(typeVariables),
super(ref);
- final Symbol simpleName;
+ final _MirrorReference _reflectee;
+ Symbol _simpleName;
+ Symbol get simpleName {
+ // dynamic, void and the function types have their names set eagerly in the
+ // constructor.
+ if(_simpleName == null) {
+ _simpleName = _s(_ClassMirror_name(_reflectee));
+ }
+ return _simpleName;
+ }
+
Symbol _qualifiedName = null;
Symbol get qualifiedName {
if (_qualifiedName == null) {
@@ -558,6 +573,9 @@
static _invokeConstructor(ref, constructorName, positionalArguments, async)
native 'LocalClassMirrorImpl_invokeConstructor';
+
+ static String _ClassMirror_name(reflectee)
+ native "ClassMirror_name";
}
class _LazyFunctionTypeMirror {
@@ -578,7 +596,8 @@
simpleName,
this._returnType,
this.parameters)
- : super(ref,
+ : super(null,
+ ref,
simpleName,
true,
null,
« 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