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

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

Issue 128933003: 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return CreateFunctionTypeMirror(cls, type); 328 return CreateFunctionTypeMirror(cls, type);
329 } else { 329 } else {
330 // We represent typedefs as non-canonical signature classes. 330 // We represent typedefs as non-canonical signature classes.
331 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror); 331 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror);
332 } 332 }
333 } 333 }
334 334
335 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0); 335 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0);
336 const Bool& is_mixin_app_alias = Bool::Get(cls.is_mixin_app_alias()); 336 const Bool& is_mixin_app_alias = Bool::Get(cls.is_mixin_app_alias());
337 337
338 const Array& args = Array::Handle(Array::New(7)); 338 const Array& args = Array::Handle(Array::New(8));
339 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); 339 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
340 args.SetAt(1, type); 340 args.SetAt(1, type);
341 // We do not set the names of anonymous mixin applications because the mirrors 341 // We do not set the names of anonymous mixin applications because the mirrors
342 // use a different naming convention than the VM (lib.S with lib.M and S&M 342 // use a different naming convention than the VM (lib.S with lib.M and S&M
343 // respectively). 343 // respectively).
344 if (!cls.IsAnonymousMixinApplication()) { 344 if (!cls.IsAnonymousMixinApplication()) {
345 args.SetAt(2, String::Handle(cls.Name())); 345 args.SetAt(2, String::Handle(cls.Name()));
346 } 346 }
347 args.SetAt(3, owner_mirror); 347 args.SetAt(3, owner_mirror);
348 args.SetAt(4, is_generic); 348 args.SetAt(4, Bool::Get(cls.is_abstract()));
349 args.SetAt(5, is_mixin_app_alias); 349 args.SetAt(5, is_generic);
350 args.SetAt(6, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); 350 args.SetAt(6, is_mixin_app_alias);
351 args.SetAt(7, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration);
351 return CreateMirror(Symbols::_LocalClassMirror(), args); 352 return CreateMirror(Symbols::_LocalClassMirror(), args);
352 } 353 }
353 354
354 355
355 static RawInstance* CreateLibraryMirror(const Library& lib) { 356 static RawInstance* CreateLibraryMirror(const Library& lib) {
356 const Array& args = Array::Handle(Array::New(3)); 357 const Array& args = Array::Handle(Array::New(3));
357 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib))); 358 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib)));
358 String& str = String::Handle(); 359 String& str = String::Handle();
359 str = lib.name(); 360 str = lib.name();
360 args.SetAt(1, str); 361 args.SetAt(1, str);
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 2047
2047 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { 2048 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) {
2048 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 2049 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
2049 const Field& field = Field::Handle(ref.GetFieldReferent()); 2050 const Field& field = Field::Handle(ref.GetFieldReferent());
2050 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); 2051 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
2051 const AbstractType& type = AbstractType::Handle(field.type()); 2052 const AbstractType& type = AbstractType::Handle(field.type());
2052 return InstantiateType(type, instantiator); 2053 return InstantiateType(type, instantiator);
2053 } 2054 }
2054 2055
2055 } // namespace dart 2056 } // 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