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:
authorJames M Snell <jasnell@gmail.com>2020-12-15 22:52:17 +0300
committerJames M Snell <jasnell@gmail.com>2021-01-03 23:58:09 +0300
commit28fe1ef63512acd40cfd1dd15918db494c92f45f (patch)
treefb65e10e0c966e2484a3f2151870738499d575b7 /src/js_udp_wrap.cc
parent7cfa1bee418696c1c97c1f2466520ab4f4cc8791 (diff)
src: reduce duplicated boilerplate with new env utility fn
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/36536 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/js_udp_wrap.cc')
-rw-r--r--src/js_udp_wrap.cc8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/js_udp_wrap.cc b/src/js_udp_wrap.cc
index c5168314118..6a9bda5cad1 100644
--- a/src/js_udp_wrap.cc
+++ b/src/js_udp_wrap.cc
@@ -16,7 +16,6 @@ using v8::HandleScope;
using v8::Int32;
using v8::Local;
using v8::Object;
-using v8::String;
using v8::Value;
// JSUDPWrap is a testing utility used by test/common/udppair.js
@@ -195,9 +194,6 @@ void JSUDPWrap::Initialize(Local<Object> target,
Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
- Local<String> js_udp_wrap_string =
- FIXED_ONE_BYTE_STRING(env->isolate(), "JSUDPWrap");
- t->SetClassName(js_udp_wrap_string);
t->InstanceTemplate()
->SetInternalFieldCount(UDPWrapBase::kUDPWrapBaseField + 1);
t->Inherit(AsyncWrap::GetConstructorTemplate(env));
@@ -207,9 +203,7 @@ void JSUDPWrap::Initialize(Local<Object> target,
env->SetProtoMethod(t, "onSendDone", OnSendDone);
env->SetProtoMethod(t, "onAfterBind", OnAfterBind);
- target->Set(env->context(),
- js_udp_wrap_string,
- t->GetFunction(context).ToLocalChecked()).Check();
+ env->SetConstructorFunction(target, "JSUDPWrap", t);
}