| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_mirrors_api.h" | 5 #include "include/dart_mirrors_api.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart.h" | 9 #include "vm/dart.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 DARTSCOPE(isolate); | 27 DARTSCOPE(isolate); |
| 28 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); | 28 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); |
| 29 if (obj.IsType()) { | 29 if (obj.IsType()) { |
| 30 const Class& cls = Class::Handle(Type::Cast(obj).type_class()); | 30 const Class& cls = Class::Handle(Type::Cast(obj).type_class()); |
| 31 return Api::NewHandle(isolate, cls.UserVisibleName()); | 31 return Api::NewHandle(isolate, cls.UserVisibleName()); |
| 32 } else { | 32 } else { |
| 33 RETURN_TYPE_ERROR(isolate, object, Class/Type); | 33 RETURN_TYPE_ERROR(isolate, object, Class/Type); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 DART_EXPORT Dart_Handle Dart_ClassName(Dart_Handle object) { | |
| 38 return ::Dart_TypeName(object); | |
| 39 } | |
| 40 | 37 |
| 41 DART_EXPORT Dart_Handle Dart_QualifiedTypeName(Dart_Handle object) { | 38 DART_EXPORT Dart_Handle Dart_QualifiedTypeName(Dart_Handle object) { |
| 42 Isolate* isolate = Isolate::Current(); | 39 Isolate* isolate = Isolate::Current(); |
| 43 DARTSCOPE(isolate); | 40 DARTSCOPE(isolate); |
| 44 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); | 41 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); |
| 45 if (obj.IsType() || obj.IsClass()) { | 42 if (obj.IsType() || obj.IsClass()) { |
| 46 const Class& cls = (obj.IsType()) ? | 43 const Class& cls = (obj.IsType()) ? |
| 47 Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj); | 44 Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj); |
| 48 return Dart_NewStringFromCString(cls.ToCString()); | 45 return Dart_NewStringFromCString(cls.ToCString()); |
| 49 } else { | 46 } else { |
| 50 RETURN_TYPE_ERROR(isolate, object, Class/Type); | 47 RETURN_TYPE_ERROR(isolate, object, Class/Type); |
| 51 } | 48 } |
| 52 } | 49 } |
| 53 | 50 |
| 54 DART_EXPORT Dart_Handle Dart_QualifiedClassName(Dart_Handle object) { | |
| 55 return ::Dart_QualifiedTypeName(object); | |
| 56 } | |
| 57 | 51 |
| 58 // --- Function and Variable Reflection --- | 52 // --- Function and Variable Reflection --- |
| 59 | 53 |
| 60 // Outside of the vm, we expose setter names with a trailing '='. | 54 // Outside of the vm, we expose setter names with a trailing '='. |
| 61 static bool HasExternalSetterSuffix(const String& name) { | 55 static bool HasExternalSetterSuffix(const String& name) { |
| 62 return name.CharAt(name.Length() - 1) == '='; | 56 return name.CharAt(name.Length() - 1) == '='; |
| 63 } | 57 } |
| 64 | 58 |
| 65 | 59 |
| 66 static RawString* RemoveExternalSetterSuffix(const String& name) { | 60 static RawString* RemoveExternalSetterSuffix(const String& name) { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 RETURN_TYPE_ERROR(isolate, closure, Instance); | 366 RETURN_TYPE_ERROR(isolate, closure, Instance); |
| 373 } | 367 } |
| 374 | 368 |
| 375 ASSERT(ClassFinalizer::AllClassesFinalized()); | 369 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 376 | 370 |
| 377 RawFunction* rf = Closure::function(closure_obj); | 371 RawFunction* rf = Closure::function(closure_obj); |
| 378 return Api::NewHandle(isolate, rf); | 372 return Api::NewHandle(isolate, rf); |
| 379 } | 373 } |
| 380 | 374 |
| 381 } // namespace dart | 375 } // namespace dart |
| OLD | NEW |