| 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_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
| (...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 return Api::Success(); | 1994 return Api::Success(); |
| 1995 } | 1995 } |
| 1996 const Instance& instance = Api::UnwrapInstanceHandle(Z, object); | 1996 const Instance& instance = Api::UnwrapInstanceHandle(Z, object); |
| 1997 if (instance.IsNull()) { | 1997 if (instance.IsNull()) { |
| 1998 *value = false; | 1998 *value = false; |
| 1999 RETURN_TYPE_ERROR(Z, object, Instance); | 1999 RETURN_TYPE_ERROR(Z, object, Instance); |
| 2000 } | 2000 } |
| 2001 CHECK_CALLBACK_STATE(T); | 2001 CHECK_CALLBACK_STATE(T); |
| 2002 Error& malformed_type_error = Error::Handle(Z); | 2002 Error& malformed_type_error = Error::Handle(Z); |
| 2003 *value = instance.IsInstanceOf(type_obj, Object::null_type_arguments(), | 2003 *value = instance.IsInstanceOf(type_obj, Object::null_type_arguments(), |
| 2004 Object::null_type_arguments(), |
| 2004 &malformed_type_error); | 2005 &malformed_type_error); |
| 2005 ASSERT(malformed_type_error.IsNull()); // Type was created from a class. | 2006 ASSERT(malformed_type_error.IsNull()); // Type was created from a class. |
| 2006 return Api::Success(); | 2007 return Api::Success(); |
| 2007 } | 2008 } |
| 2008 | 2009 |
| 2009 | 2010 |
| 2010 DART_EXPORT bool Dart_IsInstance(Dart_Handle object) { | 2011 DART_EXPORT bool Dart_IsInstance(Dart_Handle object) { |
| 2011 Thread* thread = Thread::Current(); | 2012 Thread* thread = Thread::Current(); |
| 2012 CHECK_ISOLATE(thread->isolate()); | 2013 CHECK_ISOLATE(thread->isolate()); |
| 2013 REUSABLE_OBJECT_HANDLESCOPE(thread); | 2014 REUSABLE_OBJECT_HANDLESCOPE(thread); |
| (...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3866 Type& redirect_type = Type::Handle(constructor.RedirectionType()); | 3867 Type& redirect_type = Type::Handle(constructor.RedirectionType()); |
| 3867 constructor = constructor.RedirectionTarget(); | 3868 constructor = constructor.RedirectionTarget(); |
| 3868 if (constructor.IsNull()) { | 3869 if (constructor.IsNull()) { |
| 3869 ASSERT(redirect_type.IsMalformed()); | 3870 ASSERT(redirect_type.IsMalformed()); |
| 3870 return Api::NewHandle(T, redirect_type.error()); | 3871 return Api::NewHandle(T, redirect_type.error()); |
| 3871 } | 3872 } |
| 3872 | 3873 |
| 3873 if (!redirect_type.IsInstantiated()) { | 3874 if (!redirect_type.IsInstantiated()) { |
| 3874 // The type arguments of the redirection type are instantiated from the | 3875 // The type arguments of the redirection type are instantiated from the |
| 3875 // type arguments of the type argument. | 3876 // type arguments of the type argument. |
| 3877 // We do not support generic constructors. |
| 3878 ASSERT(redirect_type.IsInstantiated(kFunctions)); |
| 3876 Error& bound_error = Error::Handle(); | 3879 Error& bound_error = Error::Handle(); |
| 3877 redirect_type ^= redirect_type.InstantiateFrom( | 3880 redirect_type ^= redirect_type.InstantiateFrom( |
| 3878 type_arguments, &bound_error, NULL, NULL, Heap::kNew); | 3881 type_arguments, Object::null_type_arguments(), &bound_error, NULL, |
| 3882 NULL, Heap::kNew); |
| 3879 if (!bound_error.IsNull()) { | 3883 if (!bound_error.IsNull()) { |
| 3880 return Api::NewHandle(T, bound_error.raw()); | 3884 return Api::NewHandle(T, bound_error.raw()); |
| 3881 } | 3885 } |
| 3882 redirect_type ^= redirect_type.Canonicalize(); | 3886 redirect_type ^= redirect_type.Canonicalize(); |
| 3883 } | 3887 } |
| 3884 | 3888 |
| 3885 type_obj = redirect_type.raw(); | 3889 type_obj = redirect_type.raw(); |
| 3886 type_arguments = redirect_type.arguments(); | 3890 type_arguments = redirect_type.arguments(); |
| 3887 | 3891 |
| 3888 cls = type_obj.type_class(); | 3892 cls = type_obj.type_class(); |
| (...skipping 2948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6837 } | 6841 } |
| 6838 | 6842 |
| 6839 | 6843 |
| 6840 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { | 6844 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { |
| 6841 #ifndef PRODUCT | 6845 #ifndef PRODUCT |
| 6842 Profiler::DumpStackTrace(context); | 6846 Profiler::DumpStackTrace(context); |
| 6843 #endif | 6847 #endif |
| 6844 } | 6848 } |
| 6845 | 6849 |
| 6846 } // namespace dart | 6850 } // namespace dart |
| OLD | NEW |