Skip to content
This repository was archived by the owner on May 12, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions BloomFilterWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ using v8::Persistent;
using v8::String;
using v8::Boolean;
using v8::Value;
using v8::NewStringType;

#if V8_MAJOR_VERSION >= 7
#define CHECK_SET(X) X.Check()
#else
#define CHECK_SET(X) (void)X
#endif

Persistent<Function> BloomFilterWrap::constructor;

Expand All @@ -35,7 +42,7 @@ void BloomFilterWrap::Init(Local<Object> exports) {

// Prepare constructor template
Local<FunctionTemplate> tpl = FunctionTemplate::New(isolate, New);
tpl->SetClassName(String::NewFromUtf8(isolate, "BloomFilter"));
tpl->SetClassName(String::NewFromUtf8(isolate, "BloomFilter", NewStringType::kNormal).ToLocalChecked());
tpl->InstanceTemplate()->SetInternalFieldCount(1);

// Prototype
Expand All @@ -44,8 +51,8 @@ void BloomFilterWrap::Init(Local<Object> exports) {

constructor.Reset(isolate, tpl->GetFunction(
isolate->GetCurrentContext()).ToLocalChecked());
exports->Set(String::NewFromUtf8(isolate, "BloomFilter"),
tpl->GetFunction(isolate->GetCurrentContext()).ToLocalChecked());
CHECK_SET(exports->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "BloomFilter", NewStringType::kNormal).ToLocalChecked(),
tpl->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()));
}

void BloomFilterWrap::New(const FunctionCallbackInfo<Value>& args) {
Expand Down