Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/cares_wrap.cc')
-rw-r--r--src/cares_wrap.cc27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc
index 71766fa3917..2bf4211b118 100644
--- a/src/cares_wrap.cc
+++ b/src/cares_wrap.cc
@@ -2345,32 +2345,17 @@ void Initialize(Local<Object> target,
Local<FunctionTemplate> aiw =
BaseObject::MakeLazilyInitializedJSTemplate(env);
aiw->Inherit(AsyncWrap::GetConstructorTemplate(env));
- Local<String> addrInfoWrapString =
- FIXED_ONE_BYTE_STRING(env->isolate(), "GetAddrInfoReqWrap");
- aiw->SetClassName(addrInfoWrapString);
- target->Set(env->context(),
- addrInfoWrapString,
- aiw->GetFunction(context).ToLocalChecked()).Check();
+ env->SetConstructorFunction(target, "GetAddrInfoReqWrap", aiw);
Local<FunctionTemplate> niw =
BaseObject::MakeLazilyInitializedJSTemplate(env);
niw->Inherit(AsyncWrap::GetConstructorTemplate(env));
- Local<String> nameInfoWrapString =
- FIXED_ONE_BYTE_STRING(env->isolate(), "GetNameInfoReqWrap");
- niw->SetClassName(nameInfoWrapString);
- target->Set(env->context(),
- nameInfoWrapString,
- niw->GetFunction(context).ToLocalChecked()).Check();
+ env->SetConstructorFunction(target, "GetNameInfoReqWrap", niw);
Local<FunctionTemplate> qrw =
BaseObject::MakeLazilyInitializedJSTemplate(env);
qrw->Inherit(AsyncWrap::GetConstructorTemplate(env));
- Local<String> queryWrapString =
- FIXED_ONE_BYTE_STRING(env->isolate(), "QueryReqWrap");
- qrw->SetClassName(queryWrapString);
- target->Set(env->context(),
- queryWrapString,
- qrw->GetFunction(context).ToLocalChecked()).Check();
+ env->SetConstructorFunction(target, "QueryReqWrap", qrw);
Local<FunctionTemplate> channel_wrap =
env->NewFunctionTemplate(ChannelWrap::New);
@@ -2397,11 +2382,7 @@ void Initialize(Local<Object> target,
env->SetProtoMethod(channel_wrap, "setLocalAddress", SetLocalAddress);
env->SetProtoMethod(channel_wrap, "cancel", Cancel);
- Local<String> channelWrapString =
- FIXED_ONE_BYTE_STRING(env->isolate(), "ChannelWrap");
- channel_wrap->SetClassName(channelWrapString);
- target->Set(env->context(), channelWrapString,
- channel_wrap->GetFunction(context).ToLocalChecked()).Check();
+ env->SetConstructorFunction(target, "ChannelWrap", channel_wrap);
}
} // anonymous namespace