| 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/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 | 516 |
| 517 // Return getter method for uninitialized fields, rather than the | 517 // Return getter method for uninitialized fields, rather than the |
| 518 // field object, since the value in the field object will not be | 518 // field object, since the value in the field object will not be |
| 519 // initialized until the first time the getter is invoked. | 519 // initialized until the first time the getter is invoked. |
| 520 const Instance& value = Instance::Handle(field.value()); | 520 const Instance& value = Instance::Handle(field.value()); |
| 521 ASSERT(value.raw() != Object::transition_sentinel().raw()); | 521 ASSERT(value.raw() != Object::transition_sentinel().raw()); |
| 522 return value.raw() == Object::sentinel().raw(); | 522 return value.raw() == Object::sentinel().raw(); |
| 523 } | 523 } |
| 524 | 524 |
| 525 | 525 |
| 526 DEFINE_NATIVE_ENTRY(ClassMirror_name, 1) { | |
| 527 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | |
| 528 const Class& klass = Class::Handle(ref.GetClassReferent()); | |
| 529 return klass.UserVisibleName(); | |
| 530 } | |
| 531 | |
| 532 | |
| 533 DEFINE_NATIVE_ENTRY(ClassMirror_library, 1) { | 526 DEFINE_NATIVE_ENTRY(ClassMirror_library, 1) { |
| 534 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 527 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
| 535 const Class& klass = Class::Handle(ref.GetClassReferent()); | 528 const Class& klass = Class::Handle(ref.GetClassReferent()); |
| 536 const Library& library = Library::Handle(klass.library()); | 529 const Library& library = Library::Handle(klass.library()); |
| 537 ASSERT(!library.IsNull()); | 530 ASSERT(!library.IsNull()); |
| 538 return CreateLibraryMirror(library); | 531 return CreateLibraryMirror(library); |
| 539 } | 532 } |
| 540 | 533 |
| 541 | 534 |
| 542 DEFINE_NATIVE_ENTRY(ClassMirror_supertype, 1) { | 535 DEFINE_NATIVE_ENTRY(ClassMirror_supertype, 1) { |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 } | 1419 } |
| 1427 | 1420 |
| 1428 | 1421 |
| 1429 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { | 1422 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { |
| 1430 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1423 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
| 1431 const Field& field = Field::Handle(ref.GetFieldReferent()); | 1424 const Field& field = Field::Handle(ref.GetFieldReferent()); |
| 1432 return field.type(); | 1425 return field.type(); |
| 1433 } | 1426 } |
| 1434 | 1427 |
| 1435 } // namespace dart | 1428 } // namespace dart |
| OLD | NEW |