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

Side by Side Diff: runtime/lib/mirrors.cc

Issue 129883002: Add ClassMirror.isAbstract to the API and VM implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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') | no next file with comments »
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/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 return CreateFunctionTypeMirror(cls, type); 333 return CreateFunctionTypeMirror(cls, type);
334 } else { 334 } else {
335 // We represent typedefs as non-canonical signature classes. 335 // We represent typedefs as non-canonical signature classes.
336 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror); 336 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror);
337 } 337 }
338 } 338 }
339 339
340 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0); 340 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0);
341 const Bool& is_mixin_app_alias = Bool::Get(cls.is_mixin_app_alias()); 341 const Bool& is_mixin_app_alias = Bool::Get(cls.is_mixin_app_alias());
342 342
343 const Array& args = Array::Handle(Array::New(7)); 343 const Array& args = Array::Handle(Array::New(8));
344 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); 344 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
345 args.SetAt(1, type); 345 args.SetAt(1, type);
346 // We do not set the names of anonymous mixin applications because the mirrors 346 // We do not set the names of anonymous mixin applications because the mirrors
347 // use a different naming convention than the VM (lib.S with lib.M and S&M 347 // use a different naming convention than the VM (lib.S with lib.M and S&M
348 // respectively). 348 // respectively).
349 if (!cls.IsAnonymousMixinApplication()) { 349 if (!cls.IsAnonymousMixinApplication()) {
350 args.SetAt(2, String::Handle(cls.Name())); 350 args.SetAt(2, String::Handle(cls.Name()));
351 } 351 }
352 args.SetAt(3, owner_mirror); 352 args.SetAt(3, owner_mirror);
353 args.SetAt(4, is_generic); 353 args.SetAt(4, Bool::Get(cls.is_abstract()));
354 args.SetAt(5, is_mixin_app_alias); 354 args.SetAt(5, is_generic);
355 args.SetAt(6, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); 355 args.SetAt(6, is_mixin_app_alias);
356 args.SetAt(7, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration);
356 return CreateMirror(Symbols::_LocalClassMirror(), args); 357 return CreateMirror(Symbols::_LocalClassMirror(), args);
357 } 358 }
358 359
359 360
360 static RawInstance* CreateLibraryMirror(const Library& lib) { 361 static RawInstance* CreateLibraryMirror(const Library& lib) {
361 const Array& args = Array::Handle(Array::New(3)); 362 const Array& args = Array::Handle(Array::New(3));
362 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib))); 363 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib)));
363 String& str = String::Handle(); 364 String& str = String::Handle();
364 str = lib.name(); 365 str = lib.name();
365 args.SetAt(1, str); 366 args.SetAt(1, str);
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 2056
2056 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { 2057 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) {
2057 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 2058 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
2058 const Field& field = Field::Handle(ref.GetFieldReferent()); 2059 const Field& field = Field::Handle(ref.GetFieldReferent());
2059 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); 2060 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
2060 const AbstractType& type = AbstractType::Handle(field.type()); 2061 const AbstractType& type = AbstractType::Handle(field.type());
2061 return InstantiateType(type, instantiator); 2062 return InstantiateType(type, instantiator);
2062 } 2063 }
2063 2064
2064 } // namespace dart 2065 } // namespace dart
OLDNEW
« 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