src: replace usage of deprecated ForceSet
PR-URL: https://github.com/nodejs/node/pull/5159 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
f8e8075a62
commit
67b5a8a936
15
src/node.cc
15
src/node.cc
@ -2800,15 +2800,20 @@ void StopProfilerIdleNotifier(const FunctionCallbackInfo<Value>& args) {
|
|||||||
|
|
||||||
#define READONLY_PROPERTY(obj, str, var) \
|
#define READONLY_PROPERTY(obj, str, var) \
|
||||||
do { \
|
do { \
|
||||||
obj->ForceSet(OneByteString(env->isolate(), str), var, v8::ReadOnly); \
|
obj->DefineOwnProperty(env->context(), \
|
||||||
|
OneByteString(env->isolate(), str), \
|
||||||
|
var, \
|
||||||
|
v8::ReadOnly).FromJust(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define READONLY_DONT_ENUM_PROPERTY(obj, str, var) \
|
#define READONLY_DONT_ENUM_PROPERTY(obj, str, var) \
|
||||||
do { \
|
do { \
|
||||||
obj->ForceSet(OneByteString(env->isolate(), str), \
|
obj->DefineOwnProperty(env->context(), \
|
||||||
var, \
|
OneByteString(env->isolate(), str), \
|
||||||
static_cast<v8::PropertyAttribute>(v8::ReadOnly | \
|
var, \
|
||||||
v8::DontEnum)); \
|
static_cast<v8::PropertyAttribute>(v8::ReadOnly | \
|
||||||
|
v8::DontEnum)) \
|
||||||
|
.FromJust(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,13 +225,17 @@ NODE_EXTERN void RunAtExit(Environment* env);
|
|||||||
#define NODE_DEFINE_CONSTANT(target, constant) \
|
#define NODE_DEFINE_CONSTANT(target, constant) \
|
||||||
do { \
|
do { \
|
||||||
v8::Isolate* isolate = target->GetIsolate(); \
|
v8::Isolate* isolate = target->GetIsolate(); \
|
||||||
|
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \
|
||||||
v8::Local<v8::String> constant_name = \
|
v8::Local<v8::String> constant_name = \
|
||||||
v8::String::NewFromUtf8(isolate, #constant); \
|
v8::String::NewFromUtf8(isolate, #constant); \
|
||||||
v8::Local<v8::Number> constant_value = \
|
v8::Local<v8::Number> constant_value = \
|
||||||
v8::Number::New(isolate, static_cast<double>(constant)); \
|
v8::Number::New(isolate, static_cast<double>(constant)); \
|
||||||
v8::PropertyAttribute constant_attributes = \
|
v8::PropertyAttribute constant_attributes = \
|
||||||
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
|
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
|
||||||
(target)->ForceSet(constant_name, constant_value, constant_attributes); \
|
(target)->DefineOwnProperty(context, \
|
||||||
|
constant_name, \
|
||||||
|
constant_value, \
|
||||||
|
constant_attributes).FromJust(); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
@ -22,10 +22,10 @@ struct sockaddr;
|
|||||||
v8::String::NewFromUtf8(isolate, constant); \
|
v8::String::NewFromUtf8(isolate, constant); \
|
||||||
v8::PropertyAttribute constant_attributes = \
|
v8::PropertyAttribute constant_attributes = \
|
||||||
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
|
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
|
||||||
target->ForceSet(isolate->GetCurrentContext(), \
|
target->DefineOwnProperty(isolate->GetCurrentContext(), \
|
||||||
constant_name, \
|
constant_name, \
|
||||||
constant_value, \
|
constant_value, \
|
||||||
constant_attributes); \
|
constant_attributes).FromJust(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
namespace node {
|
namespace node {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user