Skip to content

Commit f0e45be

Browse files
committed
Updating with requested changes and refactors
1 parent 8c6d2a5 commit f0e45be

File tree

10 files changed

+112
-313
lines changed

10 files changed

+112
-313
lines changed

generate/scripts/generateJson.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ module.exports = function generateJson() {
106106
}, {}).valueOf();
107107

108108
// decorate the definitions with required data to build the C++ files
109-
//TODO: add self ref tag here
110109
types.forEach(function(typeDef) {
111110
var typeName = typeDef.typeName;
112111
typeDef.cType = typeName;

generate/templates/filters/args_info.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,8 @@ module.exports = function(args) {
1313
jsArg++;
1414
}
1515

16-
if (cArg === args.length -1) {
17-
arg.lastArg = true;
18-
arg.firstArg = false;
19-
}
20-
else if(cArg === 0){
21-
arg.firstArg = true;
22-
arg.lastArg = false;
23-
}
24-
else {
25-
arg.lastArg = false;
26-
arg.firstArg = false;
27-
}
16+
arg.lastArg = cArg === args.length - 1;
17+
arg.firstArg = !arg.lastArg && cArg === 0;
2818

2919
arg.cArg = cArg;
3020
arg.isCppClassStringOrArray = ~["String", "Array"].indexOf(arg.cppClassName);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = function(value, other) {
2-
return (value - other);
2+
return value - other;
33
};

generate/templates/manual/include/async_baton.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ struct AsyncBatonWithResult : public AsyncBaton {
6161
};
6262

6363
struct AsyncBatonWithNoResult : public AsyncBaton {
64-
/* ResultT result;
65-
ResultT defaultResult;*/ // result returned if the callback doesn't return anything valid
6664
void (*onCompletion)(AsyncBaton *);
6765

6866
void Done() {

generate/templates/manual/include/filter_registry.h

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// This is a generated file, modify: generate/templates/templates/class_header.h
2-
31
#ifndef GITFILTERREGISTRY_H
42
#define GITFILTERREGISTRY_H
53
#include <nan.h>
@@ -23,11 +21,9 @@ using namespace node;
2321
using namespace v8;
2422

2523

26-
class GitFilterRegistry : public
27-
Nan::ObjectWrap
28-
{
24+
class GitFilterRegistry : public Nan::ObjectWrap {
2925
public:
30-
static void InitializeComponent (v8::Local<v8::Object> target);
26+
static void InitializeComponent(v8::Local<v8::Object> target);
3127

3228
static Nan::Persistent<v8::Object> persistentHandle;
3329

@@ -37,48 +33,42 @@ class GitFilterRegistry : public
3733

3834
static NAN_METHOD(GitFilterUnregister);
3935

40-
struct FilterBaton {
41-
const git_error* error;
36+
struct FilterRegisterBaton {
37+
const git_error *error;
4238
git_filter *filter;
4339
char *filter_name;
4440
int filter_priority;
4541
int error_code;
4642
};
4743

48-
struct SimpleFilterBaton {
49-
const git_error* error;
44+
struct FilterUnregisterBaton {
45+
const git_error *error;
5046
char *filter_name;
5147
int error_code;
5248
};
5349

5450
class RegisterWorker : public Nan::AsyncWorker {
5551
public:
56-
RegisterWorker(
57-
FilterBaton *_baton,
58-
Nan::Callback *callback
59-
) : Nan::AsyncWorker(callback)
60-
, baton(_baton) {};
52+
RegisterWorker(FilterRegisterBaton *_baton, Nan::Callback *callback)
53+
: Nan::AsyncWorker(callback), baton(_baton) {};
6154
~RegisterWorker() {};
6255
void Execute();
6356
void HandleOKCallback();
6457

6558
private:
66-
FilterBaton *baton;
59+
FilterRegisterBaton *baton;
6760
};
6861

69-
class UnRegisterWorker : public Nan::AsyncWorker {
62+
class UnregisterWorker : public Nan::AsyncWorker {
7063
public:
71-
UnRegisterWorker(
72-
SimpleFilterBaton *_baton,
73-
Nan::Callback *callback
74-
) : Nan::AsyncWorker(callback)
75-
, baton(_baton) {};
76-
~UnRegisterWorker() {};
64+
UnregisterWorker(FilterUnregisterBaton *_baton, Nan::Callback *callback)
65+
: Nan::AsyncWorker(callback), baton(_baton) {};
66+
~UnregisterWorker() {};
7767
void Execute();
7868
void HandleOKCallback();
7969

8070
private:
81-
SimpleFilterBaton *baton;
71+
FilterUnregisterBaton *baton;
8272
};
8373
};
8474

0 commit comments

Comments
 (0)