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