Update generated binding.cc to use newer NAN APIs
This commit is contained in:
parent
67fa9bdf4d
commit
7d1aa10f73
1 changed files with 4 additions and 4 deletions
|
|
@ -10,17 +10,17 @@ namespace {
|
||||||
|
|
||||||
NAN_METHOD(New) {}
|
NAN_METHOD(New) {}
|
||||||
|
|
||||||
void Init(Handle<Object> exports, Handle<Object> module) {
|
void Init(Local<Object> exports, Local<Object> module) {
|
||||||
Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);
|
Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);
|
||||||
tpl->SetClassName(Nan::New("Language").ToLocalChecked());
|
tpl->SetClassName(Nan::New("Language").ToLocalChecked());
|
||||||
tpl->InstanceTemplate()->SetInternalFieldCount(1);
|
tpl->InstanceTemplate()->SetInternalFieldCount(1);
|
||||||
|
|
||||||
Local<Function> constructor = tpl->GetFunction();
|
Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked();
|
||||||
Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked();
|
Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked();
|
||||||
Nan::SetInternalFieldPointer(instance, 0, tree_sitter_PARSER_NAME());
|
Nan::SetInternalFieldPointer(instance, 0, tree_sitter_PARSER_NAME());
|
||||||
|
|
||||||
instance->Set(Nan::New("name").ToLocalChecked(), Nan::New("PARSER_NAME").ToLocalChecked());
|
Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("PARSER_NAME").ToLocalChecked());
|
||||||
module->Set(Nan::New("exports").ToLocalChecked(), instance);
|
Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
NODE_MODULE(tree_sitter_PARSER_NAME_binding, Init)
|
NODE_MODULE(tree_sitter_PARSER_NAME_binding, Init)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue