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

Unified Diff: runtime/lib/isolate.cc

Issue 68813002: Fix VM not accepting static methods for Isolate.spawn. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rule out anonymous closures. Created 7 years, 1 month 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 | runtime/vm/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/isolate.cc
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc
index f9000831c29f1d16b636aeb06edaa2f8ae3a23c7..581ee7bef1b651f7f6fec76918eee74319094fde 100644
--- a/runtime/lib/isolate.cc
+++ b/runtime/lib/isolate.cc
@@ -220,8 +220,8 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 1) {
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()) {
+ if (!func.IsClosureFunction() || !func.is_static() ||
+ func.name() == Symbols::AnonymousClosure().raw()) {
Lasse Reichstein Nielsen 2013/11/12 07:51:00 This feels a little hackish. Is there a better way
Ivan Posva 2013/11/14 17:51:01 You are not protecting against this here: foo() {
Ivan Posva 2013/11/14 18:11:45 I think what you want here is: if (!func.IsImplic
Lasse Reichstein Nielsen 2013/11/15 10:10:04 Good catch! I had thought the !func.is_static() wo
throw_exception = true;
}
} else {
@@ -229,7 +229,7 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnFunction, 1) {
}
if (throw_exception) {
const String& msg = String::Handle(String::New(
- "Isolate.spawn expects to be passed a top-level function"));
+ "Isolate.spawn expects to be passed a static or top-level function"));
Exceptions::ThrowArgumentError(msg);
}
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698