Skip to content

Commit c164cf2

Browse files
committed
add a colision handler for method names
1 parent 3dd00bf commit c164cf2

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

generate/descriptor.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -986,9 +986,7 @@
986986
"ignore": true
987987
},
988988
"git_revwalk_new": {
989-
"isAsync": false,
990-
"jsFunctionName": "createRevwalk",
991-
"cppFunctionName": "CreateRevwalk"
989+
"isAsync": false
992990
}
993991
}
994992
},

generate/utils.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ var cTypeMappings = {
2323
"uint64_t": "Number"
2424
}
2525

26+
var collisionMappings = {
27+
"new": "create"
28+
}
29+
2630
var Utils = {
2731
titleCase: function(str) {
2832
return str.split(/_|\//).map(function(val, index) {
@@ -318,6 +322,16 @@ var Utils = {
318322
Utils.decorateArg(fnDef.return, classDef, fnDef, fnOverrides.return || {});
319323
}
320324

325+
_(collisionMappings).forEach(function(newName, collidingName) {
326+
if (fnDef.cppFunctionName == Utils.titleCase(collidingName)) {
327+
fnDef.cppFunctionName = Utils.titleCase(newName);
328+
}
329+
330+
if (fnDef.jsFunctionName == Utils.camelCase(collidingName)) {
331+
fnDef.jsFunctionName = Utils.camelCase(newName);
332+
}
333+
});
334+
321335
_.merge(fnDef, _.omit(fnOverrides, "args", "return"));
322336
},
323337

lib/repository.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Repository.prototype.getTag = function(oid, callback) {
183183
* @return {RevWalk}
184184
*/
185185
Repository.prototype.createRevWalk = function() {
186-
var revWalk = Revwalk.createRevwalk(this);
186+
var revWalk = Revwalk.create(this);
187187
revWalk.repo = this;
188188
return revWalk;
189189
};

0 commit comments

Comments
 (0)