| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 345 |
| 346 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0); | 346 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0); |
| 347 const Bool& is_mixin_typedef = Bool::Get(cls.is_mixin_typedef()); | 347 const Bool& is_mixin_typedef = Bool::Get(cls.is_mixin_typedef()); |
| 348 | 348 |
| 349 const Array& args = Array::Handle(Array::New(6)); | 349 const Array& args = Array::Handle(Array::New(6)); |
| 350 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); | 350 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); |
| 351 args.SetAt(1, type); | 351 args.SetAt(1, type); |
| 352 // We do not set the names of anonymous mixin applications because the mirrors | 352 // We do not set the names of anonymous mixin applications because the mirrors |
| 353 // use a different naming convention than the VM (lib.S with lib.M and S&M | 353 // use a different naming convention than the VM (lib.S with lib.M and S&M |
| 354 // respectively). | 354 // respectively). |
| 355 if (!cls.IsMixinApplication() || cls.is_mixin_typedef()) { | 355 if (!cls.IsAnonymousMixinApplication()) { |
| 356 args.SetAt(2, String::Handle(cls.Name())); | 356 args.SetAt(2, String::Handle(cls.Name())); |
| 357 } | 357 } |
| 358 args.SetAt(3, is_generic); | 358 args.SetAt(3, is_generic); |
| 359 args.SetAt(4, is_mixin_typedef); | 359 args.SetAt(4, is_mixin_typedef); |
| 360 args.SetAt(5, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); | 360 args.SetAt(5, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); |
| 361 return CreateMirror(Symbols::_LocalClassMirrorImpl(), args); | 361 return CreateMirror(Symbols::_LocalClassMirrorImpl(), args); |
| 362 } | 362 } |
| 363 | 363 |
| 364 | 364 |
| 365 static RawInstance* CreateLibraryMirror(const Library& lib) { | 365 static RawInstance* CreateLibraryMirror(const Library& lib) { |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 | 1204 |
| 1205 AbstractType& type = AbstractType::Handle(); | 1205 AbstractType& type = AbstractType::Handle(); |
| 1206 | 1206 |
| 1207 while (entries.HasNext()) { | 1207 while (entries.HasNext()) { |
| 1208 entry = entries.GetNext(); | 1208 entry = entries.GetNext(); |
| 1209 if (entry.IsClass()) { | 1209 if (entry.IsClass()) { |
| 1210 const Class& klass = Class::Cast(entry); | 1210 const Class& klass = Class::Cast(entry); |
| 1211 // We filter out function signature classes and dynamic. | 1211 // We filter out function signature classes and dynamic. |
| 1212 // TODO(12478): Should not need to filter out dynamic. | 1212 // TODO(12478): Should not need to filter out dynamic. |
| 1213 if (!klass.IsCanonicalSignatureClass() && | 1213 if (!klass.IsCanonicalSignatureClass() && |
| 1214 !klass.IsDynamicClass()) { | 1214 !klass.IsDynamicClass() && |
| 1215 !klass.IsAnonymousMixinApplication()) { |
| 1215 type = klass.DeclarationType(); | 1216 type = klass.DeclarationType(); |
| 1216 member_mirror = CreateClassMirror(klass, | 1217 member_mirror = CreateClassMirror(klass, |
| 1217 type, | 1218 type, |
| 1218 Bool::True(), // is_declaration | 1219 Bool::True(), // is_declaration |
| 1219 owner_mirror); | 1220 owner_mirror); |
| 1220 member_mirrors.Add(member_mirror); | 1221 member_mirrors.Add(member_mirror); |
| 1221 } | 1222 } |
| 1222 } else if (entry.IsField()) { | 1223 } else if (entry.IsField()) { |
| 1223 const Field& field = Field::Cast(entry); | 1224 const Field& field = Field::Cast(entry); |
| 1224 member_mirror = CreateVariableMirror(field, owner_mirror); | 1225 member_mirror = CreateVariableMirror(field, owner_mirror); |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 } | 1975 } |
| 1975 | 1976 |
| 1976 | 1977 |
| 1977 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { | 1978 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { |
| 1978 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1979 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
| 1979 const Field& field = Field::Handle(ref.GetFieldReferent()); | 1980 const Field& field = Field::Handle(ref.GetFieldReferent()); |
| 1980 return field.type(); | 1981 return field.type(); |
| 1981 } | 1982 } |
| 1982 | 1983 |
| 1983 } // namespace dart | 1984 } // namespace dart |
| OLD | NEW |