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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 16757007: Changes to mirrors in support of metadata access at runtime. Assumes VM changes in flight.… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 23928)
+++ runtime/lib/mirrors_impl.dart (working copy)
@@ -70,6 +70,10 @@
return result;
}
+List<InstanceMirror> _metadata(mirror)
+ native 'Mirrors_metadata';
+
+
class _LocalMirrorSystemImpl extends MirrorSystem {
// Change parameter back to "this.libraries" when native code is changed.
_LocalMirrorSystemImpl(Map<String, LibraryMirror> libraries, this.isolate)
@@ -602,6 +606,10 @@
}
}
+ // 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();
+
static _invokeConstructor(ref, constructorName, positionalArguments, async)
native 'LocalClassMirrorImpl_invokeConstructor';
}
@@ -704,6 +712,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();
+
String toString() => "TypeVariableMirror on '$simpleName'";
}
@@ -843,6 +855,10 @@
return _variables;
}
+ // 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();
+
String toString() => "LibraryMirror on '$simpleName'";
}
@@ -943,6 +959,13 @@
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(this).map(reflect).toList();
+ }
+
String toString() => "MethodMirror on '$simpleName'";
}
@@ -997,6 +1020,13 @@
final bool isStatic;
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();
+ }
+
String toString() => "VariableMirror on '$simpleName'";
}
« 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