Skip to content

Commit

Permalink
replace SetAccessor -> SetNativeDataProperty (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoopa authored Oct 10, 2024
1 parent 991ddb5 commit 6bd62c9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions nan.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand Down Expand Up @@ -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_
Expand Down Expand Up @@ -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
Expand All @@ -2717,6 +2737,7 @@ inline bool SetAccessor(
, dataobj
, settings
, attribute).FromMaybe(false);
#endif
#else
return obj->SetAccessor(
name
Expand Down

0 comments on commit 6bd62c9

Please sign in to comment.