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); |
} |