From de1f2627546270ab798c81754dd8fddb6283da3f Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Fri, 15 Mar 2019 20:53:22 +0800 Subject: [PATCH] src: elevate v8 namespaces for PropertyAttribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/26681 Reviewed-By: James M Snell Reviewed-By: Michaƫl Zasso Reviewed-By: Beth Griggs Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: Yongsheng Zhang --- src/fs_event_wrap.cc | 2 +- src/node_file.cc | 7 +++++-- src/stream_base.cc | 7 +++++-- src/udp_wrap.cc | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index 8009be6a10ad03..acdaff586cec50 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -118,7 +118,7 @@ void FSEventWrap::Initialize(Local target, FIXED_ONE_BYTE_STRING(env->isolate(), "initialized"), get_initialized_templ, Local(), - static_cast(ReadOnly | DontDelete | v8::DontEnum)); + static_cast(ReadOnly | DontDelete | DontEnum)); target->Set(env->context(), fsevent_string, diff --git a/src/node_file.cc b/src/node_file.cc index 79ba2c21cf1700..dbaa089ef21689 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -53,6 +53,7 @@ namespace fs { using v8::Array; using v8::BigUint64Array; using v8::Context; +using v8::DontDelete; using v8::EscapableHandleScope; using v8::Float64Array; using v8::Function; @@ -68,6 +69,8 @@ using v8::Number; using v8::Object; using v8::ObjectTemplate; using v8::Promise; +using v8::PropertyAttribute; +using v8::ReadOnly; using v8::String; using v8::Symbol; using v8::Uint32; @@ -120,8 +123,8 @@ FileHandle* FileHandle::New(Environment* env, int fd, Local obj) { .ToLocal(&obj)) { return nullptr; } - v8::PropertyAttribute attr = - static_cast(v8::ReadOnly | v8::DontDelete); + PropertyAttribute attr = + static_cast(ReadOnly | DontDelete); if (obj->DefineOwnProperty(env->context(), env->fd_string(), Integer::New(env->isolate(), fd), diff --git a/src/stream_base.cc b/src/stream_base.cc index 7aef9ba96d14a0..3874d2d9af0456 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -18,12 +18,15 @@ namespace node { using v8::Array; using v8::ArrayBuffer; using v8::Context; +using v8::DontDelete; +using v8::DontEnum; using v8::External; using v8::FunctionCallbackInfo; using v8::HandleScope; using v8::Integer; using v8::Local; using v8::Object; +using v8::ReadOnly; using v8::String; using v8::Value; @@ -347,8 +350,8 @@ void StreamBase::AddMethod(Environment* env, void StreamBase::AddMethods(Environment* env, Local t) { HandleScope scope(env->isolate()); - enum PropertyAttribute attributes = static_cast( - v8::ReadOnly | v8::DontDelete | v8::DontEnum); + enum PropertyAttribute attributes = + static_cast(ReadOnly | DontDelete | DontEnum); Local sig = Signature::New(env->isolate(), t); AddMethod(env, sig, attributes, t, GetFD, env->fd_string()); diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 82b1dfb54c69d1..f1693aa39b9735 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -30,6 +30,7 @@ namespace node { using v8::Array; using v8::Context; +using v8::DontDelete; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; @@ -38,6 +39,7 @@ using v8::Local; using v8::MaybeLocal; using v8::Object; using v8::PropertyAttribute; +using v8::ReadOnly; using v8::Signature; using v8::String; using v8::Uint32; @@ -98,7 +100,7 @@ void UDPWrap::Initialize(Local target, t->SetClassName(udpString); enum PropertyAttribute attributes = - static_cast(v8::ReadOnly | v8::DontDelete); + static_cast(ReadOnly | DontDelete); Local signature = Signature::New(env->isolate(), t);