diff options
author | James M Snell <jasnell@gmail.com> | 2017-08-19 07:58:25 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-08-23 20:35:19 +0300 |
commit | 771a03dfe3dba6ac3136bd4aa25525220e29b0ff (patch) | |
tree | 9276a1e18c07fcead1ce87a384a7a47e42f00d79 /src/node_serdes.cc | |
parent | 0ce54a7ec96431a088a15a5e24614428184497f0 (diff) |
src: fixup strings, reduce duplication
PR-URL: https://github.com/nodejs/node/pull/14937
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_serdes.cc')
-rw-r--r-- | src/node_serdes.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/node_serdes.cc b/src/node_serdes.cc index a077598dfe4..ced9e4dd982 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -451,9 +451,11 @@ void InitializeSerdesBindings(Local<Object> target, "_setTreatArrayBufferViewsAsHostObjects", SerializerContext::SetTreatArrayBufferViewsAsHostObjects); - ser->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Serializer")); + Local<String> serializerString = + FIXED_ONE_BYTE_STRING(env->isolate(), "Serializer"); + ser->SetClassName(serializerString); target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "Serializer"), + serializerString, ser->GetFunction(env->context()).ToLocalChecked()).FromJust(); Local<FunctionTemplate> des = @@ -474,9 +476,11 @@ void InitializeSerdesBindings(Local<Object> target, env->SetProtoMethod(des, "readDouble", DeserializerContext::ReadDouble); env->SetProtoMethod(des, "_readRawBytes", DeserializerContext::ReadRawBytes); - des->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Deserializer")); + Local<String> deserializerString = + FIXED_ONE_BYTE_STRING(env->isolate(), "Deserializer"); + des->SetClassName(deserializerString); target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "Deserializer"), + deserializerString, des->GetFunction(env->context()).ToLocalChecked()).FromJust(); } |