Skip to content

Commit 5471fff

Browse files
committed
Migrate to SetAccessorProperty for Node 24
1 parent 5de0790 commit 5471fff

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/HdtDocument.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ const Nan::Persistent<Function>& HdtDocument::GetConstructor() {
6262
Nan::SetPrototypeMethod(constructorTemplate, "_readHeader", ReadHeader);
6363
Nan::SetPrototypeMethod(constructorTemplate, "_changeHeader", ChangeHeader);
6464
Nan::SetPrototypeMethod(constructorTemplate, "_close", Close);
65-
Nan::SetAccessor(constructorTemplate->PrototypeTemplate(),
66-
Nan::New("_features").ToLocalChecked(), (Nan::GetterCallback) Features);
67-
Nan::SetAccessor(constructorTemplate->PrototypeTemplate(),
68-
Nan::New("closed").ToLocalChecked(), (Nan::GetterCallback) Closed);
65+
constructorTemplate->PrototypeTemplate()->SetAccessorProperty(Nan::New("_features").ToLocalChecked(), Nan::New<v8::FunctionTemplate>(GetFeatures), v8::Local<v8::FunctionTemplate>());
66+
constructorTemplate->PrototypeTemplate()->SetAccessorProperty(Nan::New("closed").ToLocalChecked(), Nan::New<v8::FunctionTemplate>(GetClosed), v8::Local<v8::FunctionTemplate>());
6967
// Set constructor
7068
constructor.Reset(Nan::GetFunction(constructorTemplate).ToLocalChecked());
7169
}
@@ -701,7 +699,7 @@ NAN_METHOD(HdtDocument::FetchDistinctTerms) {
701699

702700

703701
// Gets a bitvector indicating the supported features.
704-
NAN_PROPERTY_GETTER(HdtDocument::Features) {
702+
NAN_METHOD(HdtDocument::GetFeatures) {
705703
HdtDocument* hdtDocument = Unwrap<HdtDocument>(info.This());
706704
info.GetReturnValue().Set(Nan::New<Integer>(hdtDocument->features));
707705
}
@@ -732,7 +730,7 @@ NAN_METHOD(HdtDocument::Close) {
732730

733731

734732
// Gets a boolean indicating whether the document is closed.
735-
NAN_PROPERTY_GETTER(HdtDocument::Closed) {
733+
NAN_METHOD(HdtDocument::GetClosed) {
736734
HdtDocument* hdtDocument = Unwrap<HdtDocument>(info.This());
737735
info.GetReturnValue().Set(Nan::New<Boolean>(!hdtDocument->hdt));
738736
}

lib/HdtDocument.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ class HdtDocument : public node::ObjectWrap {
4545
// HdtDocument#_changeHeader(headerString, outputFile, callback, self)
4646
static NAN_METHOD(ChangeHeader);
4747
// HdtDocument#_features
48-
static NAN_PROPERTY_GETTER(Features);
48+
static NAN_METHOD(GetFeatures);
4949
// HdtDocument#close([callback], [self])
5050
static NAN_METHOD(Close);
5151
// HdtDocument#closed
52-
static NAN_PROPERTY_GETTER(Closed);
52+
static NAN_METHOD(GetClosed);
5353
};
5454

5555
// Check if a term is a variable

0 commit comments

Comments
 (0)