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

Unified Diff: runtime/lib/mirrors.cc

Issue 23190003: ClassMirror.mixin (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: split test to maintain coverage 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/vm/parser.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 e0c8b2327c4e75efe5ff64fc4e49c3e10a4ee74f..7fa930bfa2acd843712c018aecaa477bff3662f3 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -199,12 +199,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()) {
+ args.SetAt(2, String::Handle(cls.UserVisibleName()));
+ }
args.SetAt(3, is_generic);
+ args.SetAt(4, is_mixin_typedef);
return CreateMirror(Symbols::_LocalClassMirrorImpl(), args);
}
@@ -466,6 +474,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/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698