From 6bd62c9a0004339d5d1e18a945c84929d0f6b808 Mon Sep 17 00:00:00 2001 From: Benjamin Byholm Date: Fri, 11 Oct 2024 00:12:40 +0300 Subject: [PATCH] replace SetAccessor -> SetNativeDataProperty (#977) --- nan.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/nan.h b/nan.h index 78e266d5..13939a3b 100644 --- a/nan.h +++ b/nan.h @@ -2615,7 +2615,11 @@ NAN_DEPRECATED inline void SetAccessor( obj->SetInternalField(imp::kDataIndex, data); } +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 5)) + tpl->SetNativeDataProperty( +#else tpl->SetAccessor( +#endif name , getter_ , setter_ @@ -2663,7 +2667,11 @@ inline void SetAccessor( obj->SetInternalField(imp::kDataIndex, data); } +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 5)) + tpl->SetNativeDataProperty( +#else tpl->SetAccessor( +#endif name , getter_ , setter_ @@ -2709,6 +2717,18 @@ inline bool SetAccessor( } #if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) +#if defined(V8_MAJOR_VERSION) && \ + (V8_MAJOR_VERSION > 12 || \ + (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && \ + V8_MINOR_VERSION >= 5)) + return obj->SetNativeDataProperty( + GetCurrentContext() + , name + , getter_ + , setter_ + , dataobj + , attribute).FromMaybe(false); +#else return obj->SetAccessor( GetCurrentContext() , name @@ -2717,6 +2737,7 @@ inline bool SetAccessor( , dataobj , settings , attribute).FromMaybe(false); +#endif #else return obj->SetAccessor( name