@@ -14,7 +14,8 @@ var typeMap = require("./types.json");
1414// Structs or new types between v0.18 and v0.20.
1515typeMap . __proto__ = {
1616 "git_filter_mode_t" : { cpp : "Number" , js : "Number" } ,
17- "const git_blame_hunk*" : { cpp : "GitBlameHunk" , js : "BlameHunk" } ,
17+ "const git_blame_hunk *" : { cpp : "GitBlameHunk" , js : "BlameHunk" } ,
18+ "git_blame_hunk *" : { cpp : "GitBlameHunk" , js : "BlameHunk" } ,
1819 "git_filter *" : { cpp : "GitFilter" , js : "Filter" } ,
1920 "const git_status_entry *" : { cpp : "StatusEntry" , js : "StatusEntry" } ,
2021 "const git_index_name_entry *" : {
@@ -81,8 +82,14 @@ Object.keys(descriptor).forEach(function(fileName, index) {
8182 file . freeFunctionName = "git_" + fileName + "_free" ;
8283 }
8384
85+ var cFile = libgit2 . files [ index ] ;
86+
87+ if ( ! cFile || ! cFile . functions ) {
88+ return ;
89+ }
90+
8491 // Doesn't actually exist.
85- if ( libgit2 . files [ index ] . functions . indexOf ( file . freeFunctionName ) === - 1 ) {
92+ if ( cFile . functions . indexOf ( file . freeFunctionName ) === - 1 ) {
8693 delete file . freeFunctionName ;
8794 }
8895
@@ -108,7 +115,7 @@ Object.keys(descriptor).forEach(function(fileName, index) {
108115 }
109116 } ;
110117
111- libgit2 . files [ index ] . functions . forEach ( function ( functionName ) {
118+ cFile . functions . forEach ( function ( functionName ) {
112119 var funcDescriptor = libgit2 . functions [ functionName ] ;
113120
114121 var args = funcDescriptor . args || [ ] ;
@@ -280,5 +287,5 @@ Object.keys(descriptor).forEach(function(fileName, index) {
280287fs . writeFileSync ( path . join ( __dirname , "types.json" ) ,
281288 JSON . stringify ( typeMap , null , 2 ) ) ;
282289
283- fs . writeFileSync ( path . join ( __dirname , "compare .json" ) ,
290+ fs . writeFileSync ( path . join ( __dirname , "idefs .json" ) ,
284291 JSON . stringify ( files , null , 2 ) ) ;
0 commit comments