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

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') | 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 e897ab5b756b22e4e9ef9591c03ba349e858a95b..9386f4bf915694669b5a33d2afc6924e72884c6e 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -238,7 +238,7 @@ static RawInstance* CreateMethodMirror(const Function& func,
args.SetAt(4, Bool::Get(func.is_abstract()));
args.SetAt(5, Bool::Get(func.IsGetterFunction()));
args.SetAt(6, Bool::Get(func.IsSetterFunction()));
- args.SetAt(7, Bool::Get(func.IsConstructor()));
+ args.SetAt(7, Bool::Get(func.kind() == RawFunction::kConstructor));
// TODO(mlippautz): Implement different constructor kinds.
args.SetAt(8, Bool::False());
args.SetAt(9, Bool::False());
@@ -299,12 +299,19 @@ static RawInstance* CreateClassMirror(const Class& cls,
}
const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0);
+ const Bool& is_mixin_typedef = Bool::Get(cls.is_mixin_typedef());
- 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 ((cls.mixin() == Type::null()) || 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);
}
@@ -541,6 +548,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698