Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-02-26 01:37:33 +0300
committerMyles Borins <mylesborins@google.com>2020-03-05 00:30:03 +0300
commit4d5318c16467623770bb77f7ecac720cb93b0326 (patch)
treee8ab0642e7b87beb91a63eeafa33a3b547f3cd28 /src/module_wrap.cc
parent0fc45f80b59db586c46d8b0fca265446a46ed121 (diff)
src: improve handling of internal field counting
Change suggested by bnoordhuis. Improve handing of internal field counting by using enums. Helps protect against future possible breakage if field indexes are ever changed or added to. Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/31960 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/module_wrap.cc')
-rw-r--r--src/module_wrap.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
index 5d758bac620..2b1708088bf 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -1636,7 +1636,8 @@ void ModuleWrap::Initialize(Local<Object> target,
Local<FunctionTemplate> tpl = env->NewFunctionTemplate(New);
tpl->SetClassName(FIXED_ONE_BYTE_STRING(isolate, "ModuleWrap"));
- tpl->InstanceTemplate()->SetInternalFieldCount(1);
+ tpl->InstanceTemplate()->SetInternalFieldCount(
+ ModuleWrap::kInternalFieldCount);
env->SetProtoMethod(tpl, "link", Link);
env->SetProtoMethod(tpl, "instantiate", Instantiate);