| 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 17 matching lines...) Expand all Loading... |
| 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) { | 37 DART_EXPORT Dart_Handle Dart_ClassName(Dart_Handle object) { |
| 38 return Dart_TypeName(object); | 38 return ::Dart_TypeName(object); |
| 39 } | 39 } |
| 40 | 40 |
| 41 DART_EXPORT Dart_Handle Dart_QualifiedTypeName(Dart_Handle object) { | 41 DART_EXPORT Dart_Handle Dart_QualifiedTypeName(Dart_Handle object) { |
| 42 Isolate* isolate = Isolate::Current(); | 42 Isolate* isolate = Isolate::Current(); |
| 43 DARTSCOPE(isolate); | 43 DARTSCOPE(isolate); |
| 44 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); | 44 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); |
| 45 if (obj.IsType() || obj.IsClass()) { | 45 if (obj.IsType() || obj.IsClass()) { |
| 46 const Class& cls = (obj.IsType()) ? | 46 const Class& cls = (obj.IsType()) ? |
| 47 Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj); | 47 Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj); |
| 48 return Dart_NewStringFromCString(cls.ToCString()); | 48 return Dart_NewStringFromCString(cls.ToCString()); |
| 49 } else { | 49 } else { |
| 50 RETURN_TYPE_ERROR(isolate, object, Class/Type); | 50 RETURN_TYPE_ERROR(isolate, object, Class/Type); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 DART_EXPORT Dart_Handle Dart_QualifiedClassName(Dart_Handle object) { | 54 DART_EXPORT Dart_Handle Dart_QualifiedClassName(Dart_Handle object) { |
| 55 return Dart_QualifiedTypeName(object); | 55 return ::Dart_QualifiedTypeName(object); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // --- Function and Variable Reflection --- | 58 // --- Function and Variable Reflection --- |
| 59 | 59 |
| 60 // Outside of the vm, we expose setter names with a trailing '='. | 60 // Outside of the vm, we expose setter names with a trailing '='. |
| 61 static bool HasExternalSetterSuffix(const String& name) { | 61 static bool HasExternalSetterSuffix(const String& name) { |
| 62 return name.CharAt(name.Length() - 1) == '='; | 62 return name.CharAt(name.Length() - 1) == '='; |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 RETURN_TYPE_ERROR(isolate, closure, Instance); | 372 RETURN_TYPE_ERROR(isolate, closure, Instance); |
| 373 } | 373 } |
| 374 | 374 |
| 375 ASSERT(ClassFinalizer::AllClassesFinalized()); | 375 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 376 | 376 |
| 377 RawFunction* rf = Closure::function(closure_obj); | 377 RawFunction* rf = Closure::function(closure_obj); |
| 378 return Api::NewHandle(isolate, rf); | 378 return Api::NewHandle(isolate, rf); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace dart | 381 } // namespace dart |
| OLD | NEW |