From 21e2ae890d1af70e1944ff19e964b69619e29f58 Mon Sep 17 00:00:00 2001 From: Daeyeon Jeong Date: Wed, 23 Nov 2022 15:13:18 +0900 Subject: [PATCH] fixup! src,lib: group properties used as constants from `util` binding Signed-off-by: Daeyeon Jeong --- src/node_util.cc | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/node_util.cc b/src/node_util.cc index 40a8e90cfc4ded..48769c0ad816c2 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -381,10 +381,13 @@ void Initialize(Local target, } { - Local tmpl = ObjectTemplate::New(isolate); + Local constants = Object::New(env->isolate()); #define V(name) \ - tmpl->Set(FIXED_ONE_BYTE_STRING(isolate, #name), \ - Integer::New(isolate, Promise::PromiseState::name)); + constants \ + ->Set(context, \ + FIXED_ONE_BYTE_STRING(isolate, #name), \ + Integer::New(isolate, Promise::PromiseState::name)) \ + .Check(); V(kPending); V(kFulfilled); @@ -392,8 +395,11 @@ void Initialize(Local target, #undef V #define V(name) \ - tmpl->Set(FIXED_ONE_BYTE_STRING(isolate, #name), \ - Integer::New(isolate, Environment::ExitInfoField::name)); + constants \ + ->Set(context, \ + FIXED_ONE_BYTE_STRING(isolate, #name), \ + Integer::New(isolate, Environment::ExitInfoField::name)) \ + .Check(); V(kExiting); V(kExitCode); @@ -401,8 +407,11 @@ void Initialize(Local target, #undef V #define V(name) \ - tmpl->Set(FIXED_ONE_BYTE_STRING(isolate, #name), \ - Integer::New(isolate, PropertyFilter::name)); + constants \ + ->Set(context, \ + FIXED_ONE_BYTE_STRING(isolate, #name), \ + Integer::New(isolate, PropertyFilter::name)) \ + .Check(); V(ALL_PROPERTIES); V(ONLY_WRITABLE); @@ -412,11 +421,7 @@ void Initialize(Local target, V(SKIP_SYMBOLS); #undef V - target - ->Set(context, - env->constants_string(), - tmpl->NewInstance(context).ToLocalChecked()) - .Check(); + target->Set(context, env->constants_string(), constants).Check(); } SetMethodNoSideEffect(