Index: vm/dart_api_impl.cc |
=================================================================== |
--- vm/dart_api_impl.cc (revision 13564) |
+++ vm/dart_api_impl.cc (working copy) |
@@ -2384,21 +2384,22 @@ |
// different signature classes for closures. |
Isolate* isolate = Isolate::Current(); |
DARTSCOPE(isolate); |
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object)); |
- return obj.IsClosure(); |
+ const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, object); |
+ return (!closure_obj.IsNull() && closure_obj.IsClosure()); |
} |
DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) { |
Isolate* isolate = Isolate::Current(); |
DARTSCOPE(isolate); |
- const Closure& closure_obj = Api::UnwrapClosureHandle(isolate, closure); |
- if (closure_obj.IsNull()) { |
- RETURN_TYPE_ERROR(isolate, closure, Closure); |
+ const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure); |
+ if (closure_obj.IsNull() || !closure_obj.IsClosure()) { |
+ RETURN_TYPE_ERROR(isolate, closure, Instance); |
} |
+ |
ASSERT(ClassFinalizer::AllClassesFinalized()); |
- RawFunction* rf = closure_obj.function(); |
+ RawFunction* rf = Closure::function(closure_obj); |
return Api::NewHandle(isolate, rf); |
} |
@@ -2408,9 +2409,9 @@ |
Dart_Handle* arguments) { |
Isolate* isolate = Isolate::Current(); |
DARTSCOPE(isolate); |
- const Closure& closure_obj = Api::UnwrapClosureHandle(isolate, closure); |
- if (closure_obj.IsNull()) { |
- RETURN_TYPE_ERROR(isolate, closure, Closure); |
+ const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure); |
+ if (closure_obj.IsNull() || !closure_obj.IsClosure()) { |
+ RETURN_TYPE_ERROR(isolate, closure, Instance); |
} |
if (number_of_arguments < 0) { |
return Api::NewError( |