From 935c48c9e6cd6b77a434d79ac3cf35ccaf7e29a1 Mon Sep 17 00:00:00 2001 From: raisinten Date: Sun, 15 Nov 2020 20:54:12 +0530 Subject: [PATCH] src: refactor using-declarations node_env_var.cc PR-URL: https://github.com/nodejs/node/pull/36128 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/node_env_var.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/node_env_var.cc b/src/node_env_var.cc index 1a162888fd37a7..817e2d924079b8 100644 --- a/src/node_env_var.cc +++ b/src/node_env_var.cc @@ -9,6 +9,8 @@ namespace node { using v8::Array; using v8::Boolean; using v8::Context; +using v8::DontDelete; +using v8::DontEnum; using v8::EscapableHandleScope; using v8::HandleScope; using v8::Integer; @@ -25,6 +27,7 @@ using v8::Object; using v8::ObjectTemplate; using v8::PropertyCallbackInfo; using v8::PropertyHandlerFlags; +using v8::ReadOnly; using v8::String; using v8::Value; @@ -92,10 +95,10 @@ Maybe RealEnvStore::Get(const char* key) const { } if (ret >= 0) { // Env key value fetch success. - return v8::Just(std::string(*val, init_sz)); + return Just(std::string(*val, init_sz)); } - return v8::Nothing(); + return Nothing(); } MaybeLocal RealEnvStore::Get(Isolate* isolate, @@ -140,9 +143,9 @@ int32_t RealEnvStore::Query(const char* key) const { #ifdef _WIN32 if (key[0] == '=') { - return static_cast(v8::ReadOnly) | - static_cast(v8::DontDelete) | - static_cast(v8::DontEnum); + return static_cast(ReadOnly) | + static_cast(DontDelete) | + static_cast(DontEnum); } #endif @@ -190,7 +193,7 @@ Local RealEnvStore::Enumerate(Isolate* isolate) const { return Array::New(isolate, env_v.out(), env_v_index); } -std::shared_ptr KVStore::Clone(v8::Isolate* isolate) const { +std::shared_ptr KVStore::Clone(Isolate* isolate) const { HandleScope handle_scope(isolate); Local context = isolate->GetCurrentContext(); @@ -210,7 +213,7 @@ std::shared_ptr KVStore::Clone(v8::Isolate* isolate) const { Maybe MapKVStore::Get(const char* key) const { Mutex::ScopedLock lock(mutex_); auto it = map_.find(key); - return it == map_.end() ? v8::Nothing() : v8::Just(it->second); + return it == map_.end() ? Nothing() : Just(it->second); } MaybeLocal MapKVStore::Get(Isolate* isolate, Local key) const {