From 8250aa01d40f7c15fa3648b45e09c36b45e735ae Mon Sep 17 00:00:00 2001 From: John Haley Date: Thu, 15 Jan 2015 12:44:27 -0700 Subject: [PATCH] Updated to nan 1.5.0 and fixed build errors In nan 1.5.0 NanNew does a less-greedy matching for its overloads so the 2 `New` functions caused a build error so I renamed the one meant for the js side to `jsNewFunction`. I'm hoping that's clear enough. --- generate/combyne/manual/include/wrapper.h | 2 +- generate/combyne/manual/src/wrapper.cc | 5 +++-- generate/combyne/templates/class_content.cc | 4 ++-- generate/combyne/templates/class_header.h | 2 +- generate/combyne/templates/struct_content.cc | 4 ++-- generate/combyne/templates/struct_header.h | 2 +- package.json | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/generate/combyne/manual/include/wrapper.h b/generate/combyne/manual/include/wrapper.h index 32b07ce26..5fbe0e341 100644 --- a/generate/combyne/manual/include/wrapper.h +++ b/generate/combyne/manual/include/wrapper.h @@ -25,7 +25,7 @@ class Wrapper : public ObjectWrap { private: Wrapper(void *raw); - static NAN_METHOD(New); + static NAN_METHOD(JSNewFunction); static NAN_METHOD(ToBuffer); void *raw; diff --git a/generate/combyne/manual/src/wrapper.cc b/generate/combyne/manual/src/wrapper.cc index 4b32340ff..87eb29308 100644 --- a/generate/combyne/manual/src/wrapper.cc +++ b/generate/combyne/manual/src/wrapper.cc @@ -2,6 +2,7 @@ * This code is auto-generated; unless you know what you're doing, do not modify! **/ #include +#include #include #include @@ -18,7 +19,7 @@ Wrapper::Wrapper(void *raw) { void Wrapper::InitializeComponent(Handle target) { NanScope(); - Local tpl = NanNew(New); + Local tpl = NanNew(JSNewFunction); tpl->InstanceTemplate()->SetInternalFieldCount(1); tpl->SetClassName(NanNew("Wrapper")); @@ -29,7 +30,7 @@ void Wrapper::InitializeComponent(Handle target) { target->Set(NanNew("Wrapper"), tpl->GetFunction()); } -NAN_METHOD(Wrapper::New) { +NAN_METHOD(Wrapper::JSNewFunction) { NanScope(); if (args.Length() == 0 || !args[0]->IsExternal()) { diff --git a/generate/combyne/templates/class_content.cc b/generate/combyne/templates/class_content.cc index 538b10940..b534ea4c2 100644 --- a/generate/combyne/templates/class_content.cc +++ b/generate/combyne/templates/class_content.cc @@ -41,7 +41,7 @@ using namespace node; void {{ cppClassName }}::InitializeComponent(Handle target) { NanScope(); - Local tpl = NanNew(New); + Local tpl = NanNew(JSNewFunction); tpl->InstanceTemplate()->SetInternalFieldCount(1); tpl->SetClassName(NanNew("{{ jsClassName }}")); @@ -67,7 +67,7 @@ using namespace node; target->Set(NanNew("{{ jsClassName }}"), _constructor_template); } - NAN_METHOD({{ cppClassName }}::New) { + NAN_METHOD({{ cppClassName }}::JSNewFunction) { NanScope(); if (args.Length() == 0 || !args[0]->IsExternal()) { diff --git a/generate/combyne/templates/class_header.h b/generate/combyne/templates/class_header.h index d438e0317..41d9156c8 100644 --- a/generate/combyne/templates/class_header.h +++ b/generate/combyne/templates/class_header.h @@ -49,7 +49,7 @@ class {{ cppClassName }} : public ObjectWrap { ~{{ cppClassName }}(); {%endif%} - static NAN_METHOD(New); + static NAN_METHOD(JSNewFunction); {%each fields as field%} {%if not field.ignore%} diff --git a/generate/combyne/templates/struct_content.cc b/generate/combyne/templates/struct_content.cc index 86d850d40..c06db1939 100644 --- a/generate/combyne/templates/struct_content.cc +++ b/generate/combyne/templates/struct_content.cc @@ -79,7 +79,7 @@ void {{ cppClassName }}::ConstructFields() { void {{ cppClassName }}::InitializeComponent(Handle target) { NanScope(); - Local tpl = NanNew(New); + Local tpl = NanNew(JSNewFunction); tpl->InstanceTemplate()->SetInternalFieldCount(1); tpl->SetClassName(NanNew("{{ jsClassName }}")); @@ -95,7 +95,7 @@ void {{ cppClassName }}::InitializeComponent(Handle target) { target->Set(NanNew("{{ jsClassName }}"), _constructor_template); } -NAN_METHOD({{ cppClassName }}::New) { +NAN_METHOD({{ cppClassName }}::JSNewFunction) { NanScope(); {{ cppClassName }}* instance; diff --git a/generate/combyne/templates/struct_header.h b/generate/combyne/templates/struct_header.h index be27df33a..319d86136 100644 --- a/generate/combyne/templates/struct_header.h +++ b/generate/combyne/templates/struct_header.h @@ -66,7 +66,7 @@ class {{ cppClassName }} : public ObjectWrap { void ConstructFields(); - static NAN_METHOD(New); + static NAN_METHOD(JSNewFunction); {% each fields as field %} {% if not field.ignore %} diff --git a/package.json b/package.json index b53c5b29e..4f7f3c067 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "js-beautify": "^1.5.4", "jshint": "~2.5.6", "lodash": "^2.4.1", - "nan": "~1.4.1", + "nan": "~1.5.0", "node-gyp": "~1.0.2", "nw-gyp": "^0.12.4", "request": "~2.51.0",