Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: vm/dart_api_impl.cc

Issue 11087070: - Get rid of RawClosure class and use RawInstance for closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/code_generator.cc ('k') | vm/dart_entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « vm/code_generator.cc ('k') | vm/dart_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698