Skip to content

Commit ed08562

Browse files
authored
support Node.js v26 (#1016)
1 parent 6d73808 commit ed08562

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
node-version: [25.x, 24.x, 23.x, 22.x, 21.x, 20.x, 19.x, 18.x, 17.x, 16.x]
25+
node-version: [26.x, 25.x, 24.x, 23.x, 22.x, 21.x, 20.x, 19.x, 18.x, 17.x, 16.x]
2626
os: [windows-latest]
2727
include:
2828
- node-version: lts/*

nan_callbacks_12_inl.h

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
#ifndef NAN_CALLBACKS_12_INL_H_
1010
#define NAN_CALLBACKS_12_INL_H_
1111

12+
#if defined(V8_MAJOR_VERSION) && \
13+
(V8_MAJOR_VERSION > 14 || \
14+
(V8_MAJOR_VERSION == 14 && \
15+
defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 6))
16+
# define NAN_HAS_PROPERTY_CALLBACK_INFO_HOLDER_V2 1
17+
#endif
18+
1219
template<typename T>
1320
class ReturnValue {
1421
v8::ReturnValue<T> value_;
@@ -89,6 +96,12 @@ class ReturnValue {
8996
inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); }
9097
};
9198

99+
#if defined(NAN_HAS_PROPERTY_CALLBACK_INFO_HOLDER_V2)
100+
template<>
101+
template <typename S>
102+
inline void ReturnValue<void>::Set(const v8::Local<S> &) {}
103+
#endif
104+
92105
template<typename T>
93106
class FunctionCallbackInfo {
94107
const v8::FunctionCallbackInfo<T> &info_;
@@ -159,8 +172,20 @@ class PropertyCallbackInfo {
159172

160173
inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); }
161174
inline v8::Local<v8::Value> Data() const { return data_; }
162-
inline v8::Local<v8::Object> This() const { return info_.This(); }
163-
inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
175+
inline v8::Local<v8::Object> This() const {
176+
#if defined(NAN_HAS_PROPERTY_CALLBACK_INFO_HOLDER_V2)
177+
return info_.HolderV2();
178+
#else
179+
return info_.This();
180+
#endif
181+
}
182+
inline v8::Local<v8::Object> Holder() const {
183+
#if defined(NAN_HAS_PROPERTY_CALLBACK_INFO_HOLDER_V2)
184+
return info_.HolderV2();
185+
#else
186+
return info_.Holder();
187+
#endif
188+
}
164189
inline ReturnValue<T> GetReturnValue() const {
165190
return ReturnValue<T>(info_.GetReturnValue());
166191
}

0 commit comments

Comments
 (0)