Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
John Haley committed Jan 15, 2015
commit 8250aa01d40f7c15fa3648b45e09c36b45e735ae
2 changes: 1 addition & 1 deletion generate/combyne/manual/include/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions generate/combyne/manual/src/wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* This code is auto-generated; unless you know what you're doing, do not modify!
**/
#include <nan.h>
#include <node.h>
#include <string>
#include <cstring>

Expand All @@ -18,7 +19,7 @@ Wrapper::Wrapper(void *raw) {
void Wrapper::InitializeComponent(Handle<v8::Object> target) {
NanScope();

Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(JSNewFunction);

tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->SetClassName(NanNew<String>("Wrapper"));
Expand All @@ -29,7 +30,7 @@ void Wrapper::InitializeComponent(Handle<v8::Object> target) {
target->Set(NanNew<String>("Wrapper"), tpl->GetFunction());
}

NAN_METHOD(Wrapper::New) {
NAN_METHOD(Wrapper::JSNewFunction) {
NanScope();

if (args.Length() == 0 || !args[0]->IsExternal()) {
Expand Down
4 changes: 2 additions & 2 deletions generate/combyne/templates/class_content.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ using namespace node;
void {{ cppClassName }}::InitializeComponent(Handle<v8::Object> target) {
NanScope();

Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(JSNewFunction);

tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->SetClassName(NanNew<String>("{{ jsClassName }}"));
Expand All @@ -67,7 +67,7 @@ using namespace node;
target->Set(NanNew<String>("{{ jsClassName }}"), _constructor_template);
}

NAN_METHOD({{ cppClassName }}::New) {
NAN_METHOD({{ cppClassName }}::JSNewFunction) {
NanScope();

if (args.Length() == 0 || !args[0]->IsExternal()) {
Expand Down
2 changes: 1 addition & 1 deletion generate/combyne/templates/class_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -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%}
Expand Down
4 changes: 2 additions & 2 deletions generate/combyne/templates/struct_content.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void {{ cppClassName }}::ConstructFields() {
void {{ cppClassName }}::InitializeComponent(Handle<v8::Object> target) {
NanScope();

Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(JSNewFunction);

tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->SetClassName(NanNew<String>("{{ jsClassName }}"));
Expand All @@ -95,7 +95,7 @@ void {{ cppClassName }}::InitializeComponent(Handle<v8::Object> target) {
target->Set(NanNew<String>("{{ jsClassName }}"), _constructor_template);
}

NAN_METHOD({{ cppClassName }}::New) {
NAN_METHOD({{ cppClassName }}::JSNewFunction) {
NanScope();
{{ cppClassName }}* instance;

Expand Down
2 changes: 1 addition & 1 deletion generate/combyne/templates/struct_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down