Chromium Code Reviews| 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/mirrors.h" | 5 #include "lib/mirrors.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/bootstrap_natives.h" | 8 #include "vm/bootstrap_natives.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror); | 323 return CreateTypedefMirror(cls, type, is_declaration, owner_mirror); |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 | 326 |
| 327 const Error& error = Error::Handle(cls.EnsureIsFinalized(Isolate::Current())); | 327 const Error& error = Error::Handle(cls.EnsureIsFinalized(Isolate::Current())); |
| 328 if (!error.IsNull()) { | 328 if (!error.IsNull()) { |
| 329 Exceptions::PropagateError(error); | 329 Exceptions::PropagateError(error); |
| 330 UNREACHABLE(); | 330 UNREACHABLE(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0); | 333 const Array& args = Array::Handle(Array::New(9)); |
| 334 const Bool& is_mixin_app_alias = Bool::Get(cls.is_mixin_app_alias()); | |
| 335 | |
| 336 const Array& args = Array::Handle(Array::New(8)); | |
| 337 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); | 334 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls))); |
| 338 args.SetAt(1, type); | 335 args.SetAt(1, type); |
| 339 // Note that the VM does not consider mixin application aliases to be mixin | 336 // Note that the VM does not consider mixin application aliases to be mixin |
| 340 // applications, so this only covers anonymous mixin applications. We do not | 337 // applications, so this only covers anonymous mixin applications. We do not |
| 341 // set the names of anonymous mixin applications here because the mirrors | 338 // set the names of anonymous mixin applications here because the mirrors |
| 342 // use a different naming convention than the VM (lib.S with lib.M and S&M | 339 // use a different naming convention than the VM (lib.S with lib.M and S&M |
| 343 // respectively). | 340 // respectively). |
| 344 if (!cls.IsMixinApplication()) { | 341 if (!cls.IsMixinApplication()) { |
| 345 args.SetAt(2, String::Handle(cls.Name())); | 342 args.SetAt(2, String::Handle(cls.Name())); |
| 346 } | 343 } |
| 347 args.SetAt(3, owner_mirror); | 344 args.SetAt(3, owner_mirror); |
| 348 args.SetAt(4, Bool::Get(cls.is_abstract())); | 345 args.SetAt(4, Bool::Get(cls.is_abstract())); |
| 349 args.SetAt(5, is_generic); | 346 args.SetAt(5, Bool::Get(cls.NumTypeParameters() != 0)); |
|
siva
2015/02/26 00:07:24
How about a method IsGeneric in class Class so tha
rmacnak
2015/02/26 01:13:16
Done.
| |
| 350 args.SetAt(6, is_mixin_app_alias); | 347 args.SetAt(6, Bool::Get(cls.is_mixin_app_alias())); |
| 351 args.SetAt(7, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); | 348 args.SetAt(7, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); |
| 349 args.SetAt(8, Bool::Get(cls.is_enum_class())); | |
| 352 return CreateMirror(Symbols::_LocalClassMirror(), args); | 350 return CreateMirror(Symbols::_LocalClassMirror(), args); |
| 353 } | 351 } |
| 354 | 352 |
| 355 | 353 |
| 356 static RawInstance* CreateLibraryMirror(const Library& lib) { | 354 static RawInstance* CreateLibraryMirror(const Library& lib) { |
| 357 const Array& args = Array::Handle(Array::New(3)); | 355 const Array& args = Array::Handle(Array::New(3)); |
| 358 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib))); | 356 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib))); |
| 359 String& str = String::Handle(); | 357 String& str = String::Handle(); |
| 360 str = lib.name(); | 358 str = lib.name(); |
| 361 args.SetAt(1, str); | 359 args.SetAt(1, str); |
| (...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2030 } | 2028 } |
| 2031 | 2029 |
| 2032 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { | 2030 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { |
| 2033 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2031 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
| 2034 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2032 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
| 2035 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); | 2033 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); |
| 2036 } | 2034 } |
| 2037 | 2035 |
| 2038 | 2036 |
| 2039 } // namespace dart | 2037 } // namespace dart |
| OLD | NEW |