Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 9fe3759c5edaa3b9ca22984e4aedd208ac6dbc36..6a3ffd5420017ea10bbebb243b0b2ca6c61256af 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -4282,16 +4282,21 @@ Local<v8::Value> Object::CallAsConstructor(int argc, |
} |
-Local<Function> Function::New(Isolate* v8_isolate, |
- FunctionCallback callback, |
- Local<Value> data, |
- int length) { |
- i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
+MaybeLocal<Function> Function::New(Local<Context> context, |
+ FunctionCallback callback, Local<Value> data, |
+ int length) { |
+ i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate(); |
LOG_API(isolate, "Function::New"); |
ENTER_V8(isolate); |
- return FunctionTemplateNew( |
- isolate, callback, data, Local<Signature>(), length, true)-> |
- GetFunction(); |
+ return FunctionTemplateNew(isolate, callback, data, Local<Signature>(), |
+ length, true)->GetFunction(context); |
+} |
+ |
+ |
+Local<Function> Function::New(Isolate* v8_isolate, FunctionCallback callback, |
+ Local<Value> data, int length) { |
+ return Function::New(v8_isolate->GetCurrentContext(), callback, data, length) |
+ .FromMaybe(Local<Function>()); |
} |