OLD | NEW |
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 Loading... |
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(8)); | 343 const Array& args = Array::Handle(Array::New(7)); |
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, Bool::Get(cls.is_abstract())); | 353 args.SetAt(4, is_generic); |
354 args.SetAt(5, is_generic); | 354 args.SetAt(5, is_mixin_app_alias); |
355 args.SetAt(6, is_mixin_app_alias); | 355 args.SetAt(6, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); |
356 args.SetAt(7, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); | |
357 return CreateMirror(Symbols::_LocalClassMirror(), args); | 356 return CreateMirror(Symbols::_LocalClassMirror(), args); |
358 } | 357 } |
359 | 358 |
360 | 359 |
361 static RawInstance* CreateLibraryMirror(const Library& lib) { | 360 static RawInstance* CreateLibraryMirror(const Library& lib) { |
362 const Array& args = Array::Handle(Array::New(3)); | 361 const Array& args = Array::Handle(Array::New(3)); |
363 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib))); | 362 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib))); |
364 String& str = String::Handle(); | 363 String& str = String::Handle(); |
365 str = lib.name(); | 364 str = lib.name(); |
366 args.SetAt(1, str); | 365 args.SetAt(1, str); |
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 | 2055 |
2057 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { | 2056 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { |
2058 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 2057 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
2059 const Field& field = Field::Handle(ref.GetFieldReferent()); | 2058 const Field& field = Field::Handle(ref.GetFieldReferent()); |
2060 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); | 2059 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); |
2061 const AbstractType& type = AbstractType::Handle(field.type()); | 2060 const AbstractType& type = AbstractType::Handle(field.type()); |
2062 return InstantiateType(type, instantiator); | 2061 return InstantiateType(type, instantiator); |
2063 } | 2062 } |
2064 | 2063 |
2065 } // namespace dart | 2064 } // namespace dart |
OLD | NEW |