Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
4 changes: 1 addition & 3 deletions 4 generate/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -986,9 +986,7 @@
"ignore": true
},
"git_revwalk_new": {
"isAsync": false,
"jsFunctionName": "createRevwalk",
"cppFunctionName": "CreateRevwalk"
"isAsync": false
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion 2 generate/manual/include/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Wrapper : public ObjectWrap {
public:

static Persistent<FunctionTemplate> constructor_template;
static void Initialize (Handle<v8::Object> target);
static void InitializeComponent (Handle<v8::Object> target);

void *GetValue();
static Handle<Value> New(void *raw);
Expand Down
10 changes: 5 additions & 5 deletions 10 generate/manual/src/wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ Wrapper::Wrapper(void *raw) {
this->raw = raw;
}

void Wrapper::Initialize(Handle<v8::Object> target) {
void Wrapper::InitializeComponent(Handle<v8::Object> target) {
NanScope();

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

tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->SetClassName(NanNew<String>("Wrapper"));

NODE_SET_PROTOTYPE_METHOD(tpl, "toBuffer", ToBuffer);

NanAssignPersistent(constructor_template, tpl);
Expand All @@ -44,12 +44,12 @@ NAN_METHOD(Wrapper::New) {

Handle<Value> Wrapper::New(void *raw) {
NanEscapableScope();

Handle<Value> argv[1] = { NanNew<External>((void *)raw) };
Local<Object> instance;
Local<FunctionTemplate> constructorHandle = NanNew(constructor_template);
instance = constructorHandle->GetFunction()->NewInstance(1, argv);

return NanEscapeScope(instance);
}

Expand All @@ -67,7 +67,7 @@ NAN_METHOD(Wrapper::ToBuffer) {
int len = args[0]->ToNumber()->Value();

Local<Function> bufferConstructor = Local<Function>::Cast(
NanGetCurrentContext()->Global()->Get(NanNew<String>("Buffer")));
NanGetCurrentContext()->Global()->Get(NanNew<String>("Buffer")));

Handle<Value> constructorArgs[1] = { NanNew<Integer>(len) };
Local<Object> nodeBuffer = bufferConstructor->NewInstance(1, constructorArgs);
Expand Down
4 changes: 2 additions & 2 deletions 4 generate/templates/class_content.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ using namespace node;
{%endif%}
}

void {{ cppClassName }}::Initialize(Handle<v8::Object> target) {
void {{ cppClassName }}::InitializeComponent(Handle<v8::Object> target) {
NanScope();

Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
Expand Down Expand Up @@ -98,7 +98,7 @@ Handle<Value> {{ cppClassName }}::New(void *raw, bool selfFreeing) {
return &this->raw;
}
{%else%}
void {{ cppClassName }}::Initialize(Handle<v8::Object> target) {
void {{ cppClassName }}::InitializeComponent(Handle<v8::Object> target) {
NanScope();

Local<Object> object = NanNew<Object>();
Expand Down
2 changes: 1 addition & 1 deletion 2 generate/templates/class_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class {{ cppClassName }} : public ObjectWrap {
public:

static Persistent<Function> constructor_template;
static void Initialize (Handle<v8::Object> target);
static void InitializeComponent (Handle<v8::Object> target);

{%if cType%}
{{ cType }} *GetValue();
Expand Down
4 changes: 2 additions & 2 deletions 4 generate/templates/nodegit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
extern "C" void init(Handle<v8::Object> target) {
NanScope();

Wrapper::Initialize(target);
Wrapper::InitializeComponent(target);
{%each%}
{{ cppClassName }}::Initialize(target);
{{ cppClassName }}::InitializeComponent(target);
{%endeach%}
}

Expand Down
2 changes: 1 addition & 1 deletion 2 generate/templates/struct_content.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void {{ cppClassName }}::ConstructFields() {
{%endeach%}
}

void {{ cppClassName }}::Initialize(Handle<v8::Object> target) {
void {{ cppClassName }}::InitializeComponent(Handle<v8::Object> target) {
NanScope();

Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
Expand Down
2 changes: 1 addition & 1 deletion 2 generate/templates/struct_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class {{ cppClassName }} : public ObjectWrap {
public:
{{ cppClassName }}({{ cType }}* raw, bool selfFreeing);
static Persistent<Function> constructor_template;
static void Initialize (Handle<v8::Object> target);
static void InitializeComponent (Handle<v8::Object> target);

{{ cType }} *GetValue();
{{ cType }} **GetRefValue();
Expand Down
14 changes: 14 additions & 0 deletions 14 generate/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ var cTypeMappings = {
"uint64_t": "Number"
}

var collisionMappings = {
"new": "create"
}

var Utils = {
titleCase: function(str) {
return str.split(/_|\//).map(function(val, index) {
Expand Down Expand Up @@ -318,6 +322,16 @@ var Utils = {
Utils.decorateArg(fnDef.return, classDef, fnDef, fnOverrides.return || {});
}

_(collisionMappings).forEach(function(newName, collidingName) {
if (fnDef.cppFunctionName == Utils.titleCase(collidingName)) {
fnDef.cppFunctionName = Utils.titleCase(newName);
}

if (fnDef.jsFunctionName == Utils.camelCase(collidingName)) {
fnDef.jsFunctionName = Utils.camelCase(newName);
}
});

_.merge(fnDef, _.omit(fnOverrides, "args", "return"));
},

Expand Down
2 changes: 1 addition & 1 deletion 2 lib/repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Repository.prototype.getTag = function(oid, callback) {
* @return {RevWalk}
*/
Repository.prototype.createRevWalk = function() {
var revWalk = Revwalk.createRevwalk(this);
var revWalk = Revwalk.create(this);
revWalk.repo = this;
return revWalk;
};
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.