diff options
author | Michaƫl Zasso <mic.besace@gmail.com> | 2016-02-08 22:05:38 +0100 |
---|---|---|
committer | Ali Sheikh <ofrobots@lemonhope.roam.corp.google.com> | 2016-03-03 20:35:20 -0800 |
commit | 67b5a8a9365869009a94dbccc1fedb30a2d8c63a (patch) | |
tree | b7b5d71c99ccd0c2bad8e9e9dd2808365cadb61e /src/node.h | |
parent | f8e8075a62f910b33e6a2a93afdfe7b4df482264 (diff) | |
download | node-new-67b5a8a9365869009a94dbccc1fedb30a2d8c63a.tar.gz |
src: replace usage of deprecated ForceSet
PR-URL: https://github.com/nodejs/node/pull/5159
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/node.h')
-rw-r--r-- | src/node.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/node.h b/src/node.h index fcbb45085c..59df8e18b4 100644 --- a/src/node.h +++ b/src/node.h @@ -225,13 +225,17 @@ NODE_EXTERN void RunAtExit(Environment* env); #define NODE_DEFINE_CONSTANT(target, constant) \ do { \ v8::Isolate* isolate = target->GetIsolate(); \ + v8::Local<v8::Context> context = isolate->GetCurrentContext(); \ v8::Local<v8::String> constant_name = \ v8::String::NewFromUtf8(isolate, #constant); \ v8::Local<v8::Number> constant_value = \ v8::Number::New(isolate, static_cast<double>(constant)); \ v8::PropertyAttribute constant_attributes = \ 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) |