Skip to content

Commit b25974d

Browse files
committed
Updated tree_entry constructor
1 parent cabadca commit b25974d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

include/tree_entry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class GitTreeEntry : ObjectWrap {
2626
/**
2727
* v8::FunctionTemplate used to create Node.js constructor
2828
*/
29-
static Persistent<FunctionTemplate> constructor_template;
29+
static Persistent<Function> constructor_template;
3030

3131
/**
3232
* Used to intialize the EventEmitter from Node.js

src/tree_entry.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ using namespace v8;
1818
using namespace node;
1919

2020
void GitTreeEntry::Initialize(Handle<v8::Object> target) {
21-
Local<FunctionTemplate> t = FunctionTemplate::New(New);
21+
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
2222

23-
constructor_template = Persistent<FunctionTemplate>::New(t);
24-
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
25-
constructor_template->SetClassName(String::NewSymbol("TreeEntry"));
23+
tpl->InstanceTemplate()->SetInternalFieldCount(1);
24+
tpl->SetClassName(String::NewSymbol("TreeEntry"));
2625

27-
NODE_SET_PROTOTYPE_METHOD(constructor_template, "name", Name);
28-
NODE_SET_PROTOTYPE_METHOD(constructor_template, "attributes", Attributes);
29-
NODE_SET_PROTOTYPE_METHOD(constructor_template, "id", Id);
30-
NODE_SET_PROTOTYPE_METHOD(constructor_template, "toObject", ToObject);
26+
NODE_SET_PROTOTYPE_METHOD(tpl, "name", Name);
27+
NODE_SET_PROTOTYPE_METHOD(tpl, "attributes", Attributes);
28+
NODE_SET_PROTOTYPE_METHOD(tpl, "id", Id);
29+
NODE_SET_PROTOTYPE_METHOD(tpl, "toObject", ToObject);
3130

32-
target->Set(String::NewSymbol("TreeEntry"), constructor_template->GetFunction());
31+
constructor_template = Persistent<Function>::New(tpl->GetFunction());
32+
target->Set(String::NewSymbol("TreeEntry"), constructor_template);
3333
}
3434

3535
git_tree_entry* GitTreeEntry::GetValue() {
@@ -63,7 +63,7 @@ Handle<Value> GitTreeEntry::New(const Arguments& args) {
6363

6464
entry->Wrap(args.This());
6565

66-
return scope.Close( args.This() );
66+
return scope.Close(args.This());
6767
}
6868

6969
Handle<Value> GitTreeEntry::Name(const Arguments& args) {
@@ -121,5 +121,5 @@ Handle<Value> GitTreeEntry::ToObject(const Arguments& args) {
121121

122122
return scope.Close( Undefined() );
123123
}
124-
Persistent<FunctionTemplate> GitTreeEntry::constructor_template;
124+
Persistent<Function> GitTreeEntry::constructor_template;
125125

0 commit comments

Comments
 (0)