aravagarwal/CodeCloakPII
0
1#include "nan.h"2#include <node.h>3 4using namespace v8;5 6typedef struct TSLanguage TSLanguage;7 8extern "C" const TSLanguage *tree_sitter_python(void);9 10namespace {11 12NAN_METHOD(New) {}13 14void Init(Local<Object> exports, Local<Object> module) {15 Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);16 tpl->SetClassName(Nan::New("Language").ToLocalChecked());17 tpl->InstanceTemplate()->SetInternalFieldCount(1);18 19 Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked();20 Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked();21 Nan::SetInternalFieldPointer(instance, 0, (void *)tree_sitter_python());22 23 Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("python").ToLocalChecked());24 Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance);25}26 27NODE_MODULE_CONTEXT_AWARE(tree_sitter_python_binding, Init)28 29} // namespace30 