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

Unified Diff: lib/isolate.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 | « no previous file | vm/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/isolate.cc
===================================================================
--- lib/isolate.cc (revision 13564)
+++ lib/isolate.cc (working copy)
@@ -398,10 +398,19 @@
DEFINE_NATIVE_ENTRY(isolate_spawnFunction, 1) {
- GET_NATIVE_ARGUMENT(Closure, closure, arguments->At(0));
- const Function& func = Function::Handle(closure.function());
- const Class& cls = Class::Handle(func.Owner());
- if (!func.IsClosureFunction() || !func.is_static() || !cls.IsTopLevel()) {
+ GET_NATIVE_ARGUMENT(Instance, closure, arguments->At(0));
+ bool throw_exception = false;
+ Function& func = Function::Handle();
+ if (closure.IsClosure()) {
+ func ^= Closure::function(closure);
+ const Class& cls = Class::Handle(func.Owner());
+ if (!func.IsClosureFunction() || !func.is_static() || !cls.IsTopLevel()) {
+ throw_exception = true;
+ }
+ } else {
+ throw_exception = true;
+ }
+ if (throw_exception) {
const String& msg = String::Handle(String::New(
"spawnFunction expects to be passed a closure to a top-level static "
"function"));
@@ -409,7 +418,7 @@
}
#if defined(DEBUG)
- const Context& ctx = Context::Handle(closure.context());
+ const Context& ctx = Context::Handle(Closure::context(closure));
ASSERT(ctx.num_variables() == 0);
#endif
« no previous file with comments | « no previous file | vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698