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