From 7d1aa10f73e7a579fb2e9dcbbd25eefd0bbaf3fe Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 30 Apr 2019 17:22:14 -0700 Subject: [PATCH] Update generated binding.cc to use newer NAN APIs --- cli/src/generate/templates/binding.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/src/generate/templates/binding.cc b/cli/src/generate/templates/binding.cc index 18853f55..d68a85ab 100644 --- a/cli/src/generate/templates/binding.cc +++ b/cli/src/generate/templates/binding.cc @@ -10,17 +10,17 @@ namespace { NAN_METHOD(New) {} -void Init(Handle exports, Handle module) { +void Init(Local exports, Local module) { Local tpl = Nan::New(New); tpl->SetClassName(Nan::New("Language").ToLocalChecked()); tpl->InstanceTemplate()->SetInternalFieldCount(1); - Local constructor = tpl->GetFunction(); + Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); Local 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)