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

Unified Diff: runtime/lib/mirrors.cc

Issue 23872010: Add metadata for type parameters (TypeVariableMirror). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: addressed comments Created 7 years, 3 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 | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors.cc
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index fdfc5d85830165ac065741018204b9a2d3ae67bb..9ae7d17a40e8d9f5db18b92d37ea6cc2455d3195 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -435,9 +435,16 @@ DEFINE_NATIVE_ENTRY(MirrorReference_equals, 2) {
DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) {
- const MirrorReference& decl_ref =
- MirrorReference::CheckedHandle(arguments->NativeArgAt(0));
- const Object& decl = Object::Handle(decl_ref.referent());
+ GET_NON_NULL_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0));
+ Object& decl = Object::Handle();
+ if (reflectee.IsMirrorReference()) {
+ const MirrorReference& decl_ref = MirrorReference::Cast(reflectee);
+ decl = decl_ref.referent();
+ } else if (reflectee.IsTypeParameter()) {
+ decl = reflectee.raw();
+ } else {
+ UNREACHABLE();
+ }
Class& klass = Class::Handle();
Library& library = Library::Handle();
@@ -453,6 +460,9 @@ DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) {
library = klass.library();
} else if (decl.IsLibrary()) {
library ^= decl.raw();
+ } else if (decl.IsTypeParameter()) {
+ klass ^= TypeParameter::Cast(decl).parameterized_class();
+ library = klass.library();
} else {
return Object::empty_array().raw();
}
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698