Update generated binding.cc to use newer NAN APIs

This commit is contained in:
Max Brunsfeld 2019-04-30 17:22:14 -07:00
parent 67fa9bdf4d
commit 7d1aa10f73

View file

@ -10,17 +10,17 @@ namespace {
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);
tpl->SetClassName(Nan::New("Language").ToLocalChecked());
tpl->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> constructor = tpl->GetFunction();
Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked();
Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked();
Nan::SetInternalFieldPointer(instance, 0, tree_sitter_PARSER_NAME());
instance->Set(Nan::New("name").ToLocalChecked(), Nan::New("PARSER_NAME").ToLocalChecked());
module->Set(Nan::New("exports").ToLocalChecked(), instance);
Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("PARSER_NAME").ToLocalChecked());
Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance);
}
NODE_MODULE(tree_sitter_PARSER_NAME_binding, Init)