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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 19604004: Introduce an abstract DeclarationMirror in the implementation hierarchy; add a MirrorReference refl… (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') | no next file » | 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 25186)
+++ runtime/lib/mirrors_impl.dart (working copy)
@@ -565,9 +565,9 @@
}
List<InstanceMirror> get metadata {
- // get the metadata objects, convert them into InstanceMirrors using
- // reflect() and then make them into a Dart list
- return _metadata(_reflectee).map(reflect).toList();
+ // Get the metadata objects, convert them into InstanceMirrors using
+ // reflect() and then make them into a Dart list.
+ return _metadata(_reflectee).map(reflect).toList(growable:false);
}
static _name(reflectee)
@@ -628,7 +628,18 @@
String toString() => "FunctionTypeMirror on '${_n(simpleName)}'";
}
+abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl
+ implements DeclarationMirror {
+ _LocalDeclarationMirrorImpl(this._reflectee);
+ final _MirrorReference _reflectee;
+ List<InstanceMirror> get metadata {
+ // Get the metadata objects, convert them into InstanceMirrors using
+ // reflect() and then make them into a Dart list.
+ return _metadata(_reflectee).map(reflect).toList(growable:false);
+ }
+}
+
class _LazyTypeVariableMirror {
_LazyTypeVariableMirror(String variableName, this._owner)
: this._variableName = _s(variableName);
@@ -642,12 +653,14 @@
final _LazyTypeMirror _owner;
}
-class _LocalTypeVariableMirrorImpl extends _LocalMirrorImpl
+class _LocalTypeVariableMirrorImpl extends _LocalDeclarationMirrorImpl
implements TypeVariableMirror {
- _LocalTypeVariableMirrorImpl(String simpleName,
+ _LocalTypeVariableMirrorImpl(reflectee,
+ String simpleName,
this._owner,
this._upperBound)
- : this.simpleName = _s(simpleName);
+ : this.simpleName = _s(simpleName),
+ super(reflectee);
final Symbol simpleName;
@@ -693,12 +706,14 @@
}
-class _LocalTypedefMirrorImpl extends _LocalMirrorImpl
+class _LocalTypedefMirrorImpl extends _LocalDeclarationMirrorImpl
implements TypedefMirror {
- _LocalTypedefMirrorImpl(String simpleName,
+ _LocalTypedefMirrorImpl(reflectee,
+ String simpleName,
this._owner,
this._referent)
- : this.simpleName = _s(simpleName);
+ : this.simpleName = _s(simpleName),
+ super(reflectee);
final Symbol simpleName;
@@ -829,9 +844,9 @@
}
List<InstanceMirror> get metadata {
- // get the metadata objects, convert them into InstanceMirrors using
- // reflect() and then make them into a Dart list
- _metadata(_reflectee).map(reflect).toList();
+ // Get the metadata objects, convert them into InstanceMirrors using
+ // reflect() and then make them into a Dart list.
+ return _metadata(_reflectee).map(reflect).toList(growable:false);
}
String toString() => "LibraryMirror on '${_n(simpleName)}'";
@@ -846,9 +861,9 @@
native 'LibraryMirror_invokeSetter';
}
-class _LocalMethodMirrorImpl extends _LocalMirrorImpl
+class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl
implements MethodMirror {
- _LocalMethodMirrorImpl(this._reflectee,
+ _LocalMethodMirrorImpl(reflectee,
this._owner,
this.parameters,
this._returnType,
@@ -860,10 +875,8 @@
this.isConstConstructor,
this.isGenerativeConstructor,
this.isRedirectingConstructor,
- this.isFactoryConstructor);
+ this.isFactoryConstructor) : super(reflectee);
- final _MirrorReference _reflectee;
-
Symbol _simpleName = null;
Symbol get simpleName {
if (_simpleName == null) {
@@ -956,13 +969,6 @@
final bool isRedirectingConstructor;
final bool isFactoryConstructor;
- List<InstanceMirror> get metadata {
- owner; // ensure owner is computed
- // get the metadata objects, convert them into InstanceMirrors using
- // reflect() and then make them into a Dart list
- return _metadata(_reflectee).map(reflect).toList();
- }
-
String toString() => "MethodMirror on '${_n(simpleName)}'";
static String _MethodMirror_name(reflectee)
@@ -972,17 +978,17 @@
native "MethodMirror_owner";
}
-class _LocalVariableMirrorImpl extends _LocalMirrorImpl
+class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl
implements VariableMirror {
- _LocalVariableMirrorImpl(this._reflectee,
+ _LocalVariableMirrorImpl(reflectee,
String simpleName,
this._owner,
this._type,
this.isStatic,
this.isFinal)
- : this.simpleName = _s(simpleName);
+ : this.simpleName = _s(simpleName),
+ super(reflectee);
- final _MirrorReference _reflectee;
final Symbol simpleName;
Symbol _qualifiedName = null;
@@ -1025,12 +1031,6 @@
final bool isStatic;
final bool isFinal;
- List<InstanceMirror> get metadata {
- // get the metadata objects, convert them into InstanceMirrors using
- // reflect() and then make them into a Dart list
- return _metadata(_reflectee).map(reflect).toList();
- }
-
String toString() => "VariableMirror on '${_n(simpleName)}'";
}
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698