Skip to content

Commit 3f128ea

Browse files
committed
fix a few tests
1 parent 20acf76 commit 3f128ea

2 files changed

Lines changed: 23 additions & 16 deletions

File tree

generate/descriptor.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@
9393
}
9494
}
9595
},
96+
"clone": {
97+
"functions": {
98+
"git_clone": {
99+
"args": {
100+
"options": {
101+
"isOptional": true
102+
}
103+
}
104+
}
105+
}
106+
},
96107
"commit": {
97108
"functions": {
98109
"git_commit_create": {

generate/utils.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@ var Utils = {
3636

3737
camelCase: function(str) {
3838
return str.split(/_|\//).map(function(val, index) {
39-
return index >= 1
39+
return (index >= 1
4040
? val[0].toUpperCase() + val.slice(1)
41-
: val[0].toLowerCase() + val.slice(1);
42-
return val;
41+
: val[0].toLowerCase() + val.slice(1));
4342
}).join("");
4443
},
4544

4645
isPointer: function(cType) {
47-
return pointerRegex.test(cType);
46+
return pointerRegex.test(cType) || doublePointerRegex.test(cType);
4847
},
4948

5049
isDoublePointer: function(cType) {
@@ -267,16 +266,12 @@ var Utils = {
267266
// Mark all of the args that are either returns or are the object
268267
// itself and determine if this function goes on the prototype
269268
// or is a constructor method.
270-
arg.isReturn
271-
= arg.name === "out"
272-
|| (Utils.isDoublePointer(arg.type)
273-
&& normalizedType == classDef.cType);
274-
arg.isSelf
275-
= Utils.isPointer(arg.type)
276-
&& normalizedType == classDef.cType;
277-
278-
if (arg.isReturn && classDef.return && classDef.return.type === "int") {
279-
classDef.return.isErrorCode = true;
269+
arg.isReturn = arg.name === "out" || (Utils.isDoublePointer(arg.type) && normalizedType == classDef.cType);
270+
arg.isSelf = Utils.isPointer(arg.type) && normalizedType == classDef.cType;
271+
272+
if (arg.isReturn && fnDef.return && fnDef.return.type === "int") {
273+
debugger;
274+
fnDef.return.isErrorCode = true;
280275
fnDef.isAsync = true;
281276
}
282277

@@ -306,7 +301,8 @@ var Utils = {
306301

307302
fnDef.cppFunctionName = Utils.cTypeToCppName(key, "git_" + classDef.typeName);
308303
fnDef.jsFunctionName = Utils.cTypeToJsName(key, "git_" + classDef.typeName);
309-
fnDef.isAsync = false; // until proven otherwise
304+
//fnDef.isAsync = false; // until proven otherwise
305+
310306

311307
if (fnDef.cppFunctionName == classDef.cppClassName) {
312308
fnDef.cppFunctionName = fnDef.cppFunctionName.replace("Git", "");
@@ -318,7 +314,7 @@ var Utils = {
318314
});
319315

320316
if (fnDef.return) {
321-
Utils.decorateArg(fnDef.return, null, null, fnOverrides.return || {});
317+
Utils.decorateArg(fnDef.return, classDef, fnDef, fnOverrides.return || {});
322318
}
323319

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

0 commit comments

Comments
 (0)