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

Unified Diff: runtime/lib/mirrors.cc

Issue 23190003: ClassMirror.mixin (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 4 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/lib/mirrors_impl.dart » ('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 ed78b7bbfe150d5073e390c1a46cc88800bbbff1..a6386ca22e2a78ea23f01bb65562ee81ee6db973 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -201,12 +201,20 @@ static RawInstance* CreateClassMirror(const Class& cls,
const Bool& is_generic =
(cls.NumTypeParameters() == 0) ? Bool::False() : Bool::True();
+ const Bool& is_mixin_typedef =
+ cls.is_mixin_typedef() ? Bool::True() : Bool::False();
- const Array& args = Array::Handle(Array::New(4));
+ const Array& args = Array::Handle(Array::New(5));
args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
args.SetAt(1, type);
- args.SetAt(2, String::Handle(cls.UserVisibleName()));
+ // We do not set the names of anonymous mixin applications because the mirrors
+ // use a different naming convention than the VM (lib.S with lib.M and S&M
+ // respectively).
+ if (Type::Handle(cls.mixin()).IsNull() || cls.is_mixin_typedef()) {
siva 2013/08/26 04:30:27 if ((cls.mixin() == Type::null()) || cls.is_mixin_
rmacnak 2013/08/26 18:24:37 Done.
+ args.SetAt(2, String::Handle(cls.UserVisibleName()));
+ }
args.SetAt(3, is_generic);
+ args.SetAt(4, is_mixin_typedef);
return CreateMirror(Symbols::_LocalClassMirrorImpl(), args);
}
@@ -474,6 +482,13 @@ DEFINE_NATIVE_ENTRY(ClassMirror_interfaces, 1) {
}
+DEFINE_NATIVE_ENTRY(ClassMirror_mixin, 1) {
+ GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
+ const Class& klass = Class::Handle(ref.GetClassReferent());
+ return klass.mixin();
+}
+
+
DEFINE_NATIVE_ENTRY(ClassMirror_members, 2) {
GET_NON_NULL_NATIVE_ARGUMENT(Instance,
owner_mirror,
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | runtime/lib/mirrors_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698