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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | runtime/vm/class_finalizer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "lib/invocation_mirror.h" 5 #include "lib/invocation_mirror.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return CreateTypedefMirror(cls, owner_mirror); 196 return CreateTypedefMirror(cls, owner_mirror);
197 } 197 }
198 } 198 }
199 199
200 const Bool& is_generic = 200 const Bool& is_generic =
201 (cls.NumTypeParameters() == 0) ? Bool::False() : Bool::True(); 201 (cls.NumTypeParameters() == 0) ? Bool::False() : Bool::True();
202 202
203 const Array& args = Array::Handle(Array::New(4)); 203 const Array& args = Array::Handle(Array::New(4));
204 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); 204 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
205 args.SetAt(1, type); 205 args.SetAt(1, type);
206 args.SetAt(2, String::Handle(cls.UserVisibleName())); 206 if (Type::Handle(cls.mixin()).IsNull()) {
207 args.SetAt(2, String::Handle(cls.UserVisibleName()));
208 }
207 args.SetAt(3, is_generic); 209 args.SetAt(3, is_generic);
208 return CreateMirror(Symbols::_LocalClassMirrorImpl(), args); 210 return CreateMirror(Symbols::_LocalClassMirrorImpl(), args);
209 } 211 }
210 212
211 213
212 // Note a "raw type" is not the same as a RawType. 214 // Note a "raw type" is not the same as a RawType.
213 static RawAbstractType* RawTypeOfClass(const Class& cls) { 215 static RawAbstractType* RawTypeOfClass(const Class& cls) {
214 Type& type = Type::Handle(Type::New(cls, 216 Type& type = Type::Handle(Type::New(cls,
215 Object::null_abstract_type_arguments(), 217 Object::null_abstract_type_arguments(),
216 Scanner::kDummyTokenIndex)); 218 Scanner::kDummyTokenIndex));
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 454
453 const Error& error = Error::Handle(klass.EnsureIsFinalized(isolate)); 455 const Error& error = Error::Handle(klass.EnsureIsFinalized(isolate));
454 if (!error.IsNull()) { 456 if (!error.IsNull()) {
455 ThrowInvokeError(error); 457 ThrowInvokeError(error);
456 } 458 }
457 459
458 return klass.interfaces(); 460 return klass.interfaces();
459 } 461 }
460 462
461 463
464 DEFINE_NATIVE_ENTRY(ClassMirror_mixin, 1) {
465 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
466 const Class& klass = Class::Handle(ref.GetClassReferent());
467 return klass.mixin();
468 }
469
470
462 DEFINE_NATIVE_ENTRY(ClassMirror_members, 2) { 471 DEFINE_NATIVE_ENTRY(ClassMirror_members, 2) {
463 GET_NON_NULL_NATIVE_ARGUMENT(Instance, 472 GET_NON_NULL_NATIVE_ARGUMENT(Instance,
464 owner_mirror, 473 owner_mirror,
465 arguments->NativeArgAt(0)); 474 arguments->NativeArgAt(0));
466 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); 475 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
467 const Class& klass = Class::Handle(ref.GetClassReferent()); 476 const Class& klass = Class::Handle(ref.GetClassReferent());
468 477
469 const Error& error = Error::Handle(klass.EnsureIsFinalized(isolate)); 478 const Error& error = Error::Handle(klass.EnsureIsFinalized(isolate));
470 if (!error.IsNull()) { 479 if (!error.IsNull()) {
471 ThrowInvokeError(error); 480 ThrowInvokeError(error);
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 } 1303 }
1295 1304
1296 1305
1297 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { 1306 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) {
1298 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 1307 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1299 const Field& field = Field::Handle(ref.GetFieldReferent()); 1308 const Field& field = Field::Handle(ref.GetFieldReferent());
1300 return field.type(); 1309 return field.type();
1301 } 1310 }
1302 1311
1303 } // namespace dart 1312 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | runtime/vm/class_finalizer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698