@@ -337,12 +337,14 @@ void AsyncWrap::SetCallbackTrampoline(const FunctionCallbackInfo<Value>& args) {
337
337
Local<FunctionTemplate> AsyncWrap::GetConstructorTemplate (Environment* env) {
338
338
Local<FunctionTemplate> tmpl = env->async_wrap_ctor_template ();
339
339
if (tmpl.IsEmpty ()) {
340
- tmpl = env->NewFunctionTemplate (nullptr );
340
+ Isolate* isolate = env->isolate ();
341
+ tmpl = NewFunctionTemplate (isolate, nullptr );
341
342
tmpl->SetClassName (FIXED_ONE_BYTE_STRING (env->isolate (), " AsyncWrap" ));
342
343
tmpl->Inherit (BaseObject::GetConstructorTemplate (env));
343
- env->SetProtoMethod (tmpl, " getAsyncId" , AsyncWrap::GetAsyncId);
344
- env->SetProtoMethod (tmpl, " asyncReset" , AsyncWrap::AsyncReset);
345
- env->SetProtoMethod (tmpl, " getProviderType" , AsyncWrap::GetProviderType);
344
+ SetProtoMethod (isolate, tmpl, " getAsyncId" , AsyncWrap::GetAsyncId);
345
+ SetProtoMethod (isolate, tmpl, " asyncReset" , AsyncWrap::AsyncReset);
346
+ SetProtoMethod (
347
+ isolate, tmpl, " getProviderType" , AsyncWrap::GetProviderType);
346
348
env->set_async_wrap_ctor_template (tmpl);
347
349
}
348
350
return tmpl;
@@ -356,15 +358,15 @@ void AsyncWrap::Initialize(Local<Object> target,
356
358
Isolate* isolate = env->isolate ();
357
359
HandleScope scope (isolate);
358
360
359
- env-> SetMethod (target, " setupHooks" , SetupHooks);
360
- env-> SetMethod (target, " setCallbackTrampoline" , SetCallbackTrampoline);
361
- env-> SetMethod (target, " pushAsyncContext" , PushAsyncContext);
362
- env-> SetMethod (target, " popAsyncContext" , PopAsyncContext);
363
- env-> SetMethod (target, " executionAsyncResource" , ExecutionAsyncResource);
364
- env-> SetMethod (target, " clearAsyncIdStack" , ClearAsyncIdStack);
365
- env-> SetMethod (target, " queueDestroyAsyncId" , QueueDestroyAsyncId);
366
- env-> SetMethod (target, " setPromiseHooks" , SetPromiseHooks);
367
- env-> SetMethod (target, " registerDestroyHook" , RegisterDestroyHook);
361
+ SetMethod (context, target, " setupHooks" , SetupHooks);
362
+ SetMethod (context, target, " setCallbackTrampoline" , SetCallbackTrampoline);
363
+ SetMethod (context, target, " pushAsyncContext" , PushAsyncContext);
364
+ SetMethod (context, target, " popAsyncContext" , PopAsyncContext);
365
+ SetMethod (context, target, " executionAsyncResource" , ExecutionAsyncResource);
366
+ SetMethod (context, target, " clearAsyncIdStack" , ClearAsyncIdStack);
367
+ SetMethod (context, target, " queueDestroyAsyncId" , QueueDestroyAsyncId);
368
+ SetMethod (context, target, " setPromiseHooks" , SetPromiseHooks);
369
+ SetMethod (context, target, " registerDestroyHook" , RegisterDestroyHook);
368
370
369
371
PropertyAttribute ReadOnlyDontDelete =
370
372
static_cast <PropertyAttribute>(ReadOnly | DontDelete);
0 commit comments