diff options
author | Timothy Gu <timothygu99@gmail.com> | 2018-06-22 08:25:12 +0300 |
---|---|---|
committer | Timothy Gu <timothygu99@gmail.com> | 2018-06-26 06:15:35 +0300 |
commit | 65f617314d1ea2df8b9e16fb7e7078b5913c749c (patch) | |
tree | 719a8cf6099c336eddf75af226ca1bfbd0b73965 /src/node_buffer.cc | |
parent | cd8adfaf98613fb0ae4ba71018a236906f67f286 (diff) |
src: start annotating native code side effect
PR-URL: https://github.com/nodejs/node/pull/21458
Refs: https://github.com/nodejs/node/issues/20977
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_buffer.cc')
-rw-r--r-- | src/node_buffer.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 9465145ac37..9eb351b443a 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -1083,12 +1083,12 @@ void SetupBufferJS(const FunctionCallbackInfo<Value>& args) { Local<Object> proto = args[0].As<Object>(); env->set_buffer_prototype_object(proto); - env->SetMethod(proto, "asciiSlice", StringSlice<ASCII>); - env->SetMethod(proto, "base64Slice", StringSlice<BASE64>); - env->SetMethod(proto, "latin1Slice", StringSlice<LATIN1>); - env->SetMethod(proto, "hexSlice", StringSlice<HEX>); - env->SetMethod(proto, "ucs2Slice", StringSlice<UCS2>); - env->SetMethod(proto, "utf8Slice", StringSlice<UTF8>); + env->SetMethodNoSideEffect(proto, "asciiSlice", StringSlice<ASCII>); + env->SetMethodNoSideEffect(proto, "base64Slice", StringSlice<BASE64>); + env->SetMethodNoSideEffect(proto, "latin1Slice", StringSlice<LATIN1>); + env->SetMethodNoSideEffect(proto, "hexSlice", StringSlice<HEX>); + env->SetMethodNoSideEffect(proto, "ucs2Slice", StringSlice<UCS2>); + env->SetMethodNoSideEffect(proto, "utf8Slice", StringSlice<UTF8>); env->SetMethod(proto, "asciiWrite", StringWrite<ASCII>); env->SetMethod(proto, "base64Write", StringWrite<BASE64>); @@ -1116,22 +1116,22 @@ void Initialize(Local<Object> target, Environment* env = Environment::GetCurrent(context); env->SetMethod(target, "setupBufferJS", SetupBufferJS); - env->SetMethod(target, "createFromString", CreateFromString); + env->SetMethodNoSideEffect(target, "createFromString", CreateFromString); - env->SetMethod(target, "byteLengthUtf8", ByteLengthUtf8); + env->SetMethodNoSideEffect(target, "byteLengthUtf8", ByteLengthUtf8); env->SetMethod(target, "copy", Copy); - env->SetMethod(target, "compare", Compare); - env->SetMethod(target, "compareOffset", CompareOffset); + env->SetMethodNoSideEffect(target, "compare", Compare); + env->SetMethodNoSideEffect(target, "compareOffset", CompareOffset); env->SetMethod(target, "fill", Fill); - env->SetMethod(target, "indexOfBuffer", IndexOfBuffer); - env->SetMethod(target, "indexOfNumber", IndexOfNumber); - env->SetMethod(target, "indexOfString", IndexOfString); + env->SetMethodNoSideEffect(target, "indexOfBuffer", IndexOfBuffer); + env->SetMethodNoSideEffect(target, "indexOfNumber", IndexOfNumber); + env->SetMethodNoSideEffect(target, "indexOfString", IndexOfString); env->SetMethod(target, "swap16", Swap16); env->SetMethod(target, "swap32", Swap32); env->SetMethod(target, "swap64", Swap64); - env->SetMethod(target, "encodeUtf8String", EncodeUtf8String); + env->SetMethodNoSideEffect(target, "encodeUtf8String", EncodeUtf8String); target->Set(env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), "kMaxLength"), |