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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 if (cls.IsCanonicalSignatureClass()) { | 341 if (cls.IsCanonicalSignatureClass()) { |
342 // We represent function types as canonical signature classes. | 342 // We represent function types as canonical signature classes. |
343 return CreateFunctionTypeMirror(cls, type); | 343 return CreateFunctionTypeMirror(cls, type); |
344 } else { | 344 } else { |
345 // We represent typedefs as non-canonical signature classes. | 345 // We represent typedefs as non-canonical signature classes. |
346 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror); | 346 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror); |
347 } | 347 } |
348 } | 348 } |
349 | 349 |
350 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0); | 350 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0); |
351 const Bool& is_mixin_typedef = Bool::Get(cls.is_mixin_typedef()); | 351 const Bool& is_mixin_app_alias = Bool::Get(cls.is_mixin_app_alias()); |
352 | 352 |
353 const Array& args = Array::Handle(Array::New(6)); | 353 const Array& args = Array::Handle(Array::New(6)); |
354 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); | 354 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); |
355 args.SetAt(1, type); | 355 args.SetAt(1, type); |
356 // We do not set the names of anonymous mixin applications because the mirrors | 356 // We do not set the names of anonymous mixin applications because the mirrors |
357 // use a different naming convention than the VM (lib.S with lib.M and S&M | 357 // use a different naming convention than the VM (lib.S with lib.M and S&M |
358 // respectively). | 358 // respectively). |
359 if (!cls.IsAnonymousMixinApplication()) { | 359 if (!cls.IsAnonymousMixinApplication()) { |
360 args.SetAt(2, String::Handle(cls.Name())); | 360 args.SetAt(2, String::Handle(cls.Name())); |
361 } | 361 } |
362 args.SetAt(3, is_generic); | 362 args.SetAt(3, is_generic); |
363 args.SetAt(4, is_mixin_typedef); | 363 args.SetAt(4, is_mixin_app_alias); |
364 args.SetAt(5, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); | 364 args.SetAt(5, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); |
365 return CreateMirror(Symbols::_LocalClassMirrorImpl(), args); | 365 return CreateMirror(Symbols::_LocalClassMirrorImpl(), args); |
366 } | 366 } |
367 | 367 |
368 | 368 |
369 static RawInstance* CreateLibraryMirror(const Library& lib) { | 369 static RawInstance* CreateLibraryMirror(const Library& lib) { |
370 const Array& args = Array::Handle(Array::New(3)); | 370 const Array& args = Array::Handle(Array::New(3)); |
371 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib))); | 371 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib))); |
372 String& str = String::Handle(); | 372 String& str = String::Handle(); |
373 str = lib.name(); | 373 str = lib.name(); |
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 | 1944 |
1945 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { | 1945 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { |
1946 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1946 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
1947 const Field& field = Field::Handle(ref.GetFieldReferent()); | 1947 const Field& field = Field::Handle(ref.GetFieldReferent()); |
1948 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); | 1948 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); |
1949 const AbstractType& type = AbstractType::Handle(field.type()); | 1949 const AbstractType& type = AbstractType::Handle(field.type()); |
1950 return InstantiateType(type, instantiator); | 1950 return InstantiateType(type, instantiator); |
1951 } | 1951 } |
1952 | 1952 |
1953 } // namespace dart | 1953 } // namespace dart |
OLD | NEW |