src: elevate v8 namespaces for PropertyAttribute

PR-URL: https://github.com/nodejs/node/pull/26681
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
gengjiawen 2019-03-15 20:53:22 +08:00 committed by ZYSzys
parent 174da74701
commit cf51ee4dcf
4 changed files with 14 additions and 6 deletions

View File

@ -118,7 +118,7 @@ void FSEventWrap::Initialize(Local<Object> target,
FIXED_ONE_BYTE_STRING(env->isolate(), "initialized"), FIXED_ONE_BYTE_STRING(env->isolate(), "initialized"),
get_initialized_templ, get_initialized_templ,
Local<FunctionTemplate>(), Local<FunctionTemplate>(),
static_cast<PropertyAttribute>(ReadOnly | DontDelete | v8::DontEnum)); static_cast<PropertyAttribute>(ReadOnly | DontDelete | DontEnum));
target->Set(env->context(), target->Set(env->context(),
fsevent_string, fsevent_string,

View File

@ -53,6 +53,7 @@ namespace fs {
using v8::Array; using v8::Array;
using v8::BigUint64Array; using v8::BigUint64Array;
using v8::Context; using v8::Context;
using v8::DontDelete;
using v8::EscapableHandleScope; using v8::EscapableHandleScope;
using v8::Float64Array; using v8::Float64Array;
using v8::Function; using v8::Function;
@ -68,6 +69,8 @@ using v8::Number;
using v8::Object; using v8::Object;
using v8::ObjectTemplate; using v8::ObjectTemplate;
using v8::Promise; using v8::Promise;
using v8::PropertyAttribute;
using v8::ReadOnly;
using v8::String; using v8::String;
using v8::Symbol; using v8::Symbol;
using v8::Uint32; using v8::Uint32;
@ -120,8 +123,8 @@ FileHandle* FileHandle::New(Environment* env, int fd, Local<Object> obj) {
.ToLocal(&obj)) { .ToLocal(&obj)) {
return nullptr; return nullptr;
} }
v8::PropertyAttribute attr = PropertyAttribute attr =
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); static_cast<PropertyAttribute>(ReadOnly | DontDelete);
if (obj->DefineOwnProperty(env->context(), if (obj->DefineOwnProperty(env->context(),
env->fd_string(), env->fd_string(),
Integer::New(env->isolate(), fd), Integer::New(env->isolate(), fd),

View File

@ -18,12 +18,15 @@ namespace node {
using v8::Array; using v8::Array;
using v8::ArrayBuffer; using v8::ArrayBuffer;
using v8::Context; using v8::Context;
using v8::DontDelete;
using v8::DontEnum;
using v8::External; using v8::External;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
using v8::Object; using v8::Object;
using v8::ReadOnly;
using v8::String; using v8::String;
using v8::Value; using v8::Value;
@ -347,8 +350,8 @@ void StreamBase::AddMethod(Environment* env,
void StreamBase::AddMethods(Environment* env, Local<FunctionTemplate> t) { void StreamBase::AddMethods(Environment* env, Local<FunctionTemplate> t) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
enum PropertyAttribute attributes = static_cast<PropertyAttribute>( enum PropertyAttribute attributes =
v8::ReadOnly | v8::DontDelete | v8::DontEnum); static_cast<PropertyAttribute>(ReadOnly | DontDelete | DontEnum);
Local<Signature> sig = Signature::New(env->isolate(), t); Local<Signature> sig = Signature::New(env->isolate(), t);
AddMethod(env, sig, attributes, t, GetFD, env->fd_string()); AddMethod(env, sig, attributes, t, GetFD, env->fd_string());

View File

@ -30,6 +30,7 @@ namespace node {
using v8::Array; using v8::Array;
using v8::Context; using v8::Context;
using v8::DontDelete;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::HandleScope; using v8::HandleScope;
@ -38,6 +39,7 @@ using v8::Local;
using v8::MaybeLocal; using v8::MaybeLocal;
using v8::Object; using v8::Object;
using v8::PropertyAttribute; using v8::PropertyAttribute;
using v8::ReadOnly;
using v8::Signature; using v8::Signature;
using v8::String; using v8::String;
using v8::Uint32; using v8::Uint32;
@ -98,7 +100,7 @@ void UDPWrap::Initialize(Local<Object> target,
t->SetClassName(udpString); t->SetClassName(udpString);
enum PropertyAttribute attributes = enum PropertyAttribute attributes =
static_cast<PropertyAttribute>(v8::ReadOnly | v8::DontDelete); static_cast<PropertyAttribute>(ReadOnly | DontDelete);
Local<Signature> signature = Signature::New(env->isolate(), t); Local<Signature> signature = Signature::New(env->isolate(), t);