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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 19235015: Implement metadata as an internal native. Be honest about which mirrors don't yet support metadata … (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 25060)
+++ runtime/lib/mirrors_impl.dart (working copy)
@@ -70,8 +70,8 @@
return result;
}
-List<InstanceMirror> _metadata(mirror)
rmacnak 2013/07/16 21:11:15 This annotation is incorrect. The native answered
- native 'Mirrors_metadata';
+List _metadata(reflectee)
+ native 'DeclarationMirror_metadata';
// This will verify the argument types, unwrap them, and ensure we have a fixed
// array.
@@ -171,7 +171,7 @@
abstract class _LocalVMObjectMirrorImpl extends _LocalMirrorImpl {
_LocalVMObjectMirrorImpl(this._reference) {}
-
+
// For now, all VMObjects hold a VMReference. We could consider
// storing the Object reference itself here if the object is a Dart
// language objects (except for objects of type VMReference, of
@@ -584,7 +584,7 @@
// get the metadata objects, convert them into InstanceMirrors using
// reflect() and then make them into a Dart list
- List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList();
+ List<InstanceMirror> get metadata => _metadata(_reflectee).map(reflect).toList();
static _name(reflectee)
@@ -702,9 +702,10 @@
return _upperBound;
}
- // get the metadata objects, convert them into InstanceMirrors using
- // reflect() and then make them into a Dart list
- List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList();
+ List<InstanceMirror> get metadata {
rmacnak 2013/07/16 21:11:15 Previously this would always answer an empty list,
+ throw new UnimplementedError(
+ 'TypeVariableMirror.metadata is not implemented');
+ }
String toString() => "TypeVariableMirror on '${_n(simpleName)}'";
}
@@ -848,7 +849,7 @@
// get the metadata objects, convert them into InstanceMirrors using
// reflect() and then make them into a Dart list
- List<InstanceMirror> get metadata => _metadata(this).map(reflect).toList();
+ List<InstanceMirror> get metadata => _metadata(_reflectee).map(reflect).toList();
String toString() => "LibraryMirror on '${_n(simpleName)}'";
@@ -970,7 +971,7 @@
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(this).map(reflect).toList();
+ return _metadata(_reflectee).map(reflect).toList();
}
String toString() => "MethodMirror on '${_n(simpleName)}'";
@@ -981,13 +982,15 @@
class _LocalVariableMirrorImpl extends _LocalMirrorImpl
implements VariableMirror {
- _LocalVariableMirrorImpl(String simpleName,
+ _LocalVariableMirrorImpl(this._reflectee,
+ String simpleName,
this._owner,
this._type,
this.isStatic,
this.isFinal)
: this.simpleName = _s(simpleName);
+ final _MirrorReference _reflectee;
final Symbol simpleName;
Symbol _qualifiedName = null;
@@ -1031,10 +1034,9 @@
final bool isFinal;
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(this).map(reflect).toList();
+ return _metadata(_reflectee).map(reflect).toList();
}
String toString() => "VariableMirror on '${_n(simpleName)}'";
@@ -1043,7 +1045,7 @@
class _LocalParameterMirrorImpl extends _LocalVariableMirrorImpl
implements ParameterMirror {
_LocalParameterMirrorImpl(type, this.isOptional)
- : super('<TODO:unnamed>', null, type, false, false) {}
+ : super(null, '<TODO:unnamed>', null, type, false, false) {}
final bool isOptional;
@@ -1056,6 +1058,12 @@
throw new UnimplementedError(
'ParameterMirror.hasDefaultValue is not implemented');
}
+
+ // TODO(11418): Implement.
+ List<InstanceMirror> get metadata {
rmacnak 2013/07/16 21:11:15 Previously this raised a fatal, non-meaningful err
+ throw new UnimplementedError(
+ 'ParameterMirror.metadata is not implemented');
+ }
}
class _SpecialTypeMirrorImpl extends _LocalMirrorImpl
« 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