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

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: rebase + TODOs 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') | runtime/vm/object.cc » ('J')
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 8bed35617b56c976c75d5ebec3689bcb44ea404f..d649a11903bc0fc9494dc3148e93ec6b82d7a995 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') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698