@@ -124,6 +124,18 @@ fileNames.forEach(function(fileName, index) {
124124 cFile . fields = descriptor [ fileName ] . fields || structFile . fields || [ ] ;
125125 }
126126
127+ // This should turn 'git_clone_options' into 'git_clone_init_options'
128+ var initFnName = [ "git" ] . concat ( fileName . split ( '_' ) ) ;
129+
130+ initFnName . splice ( - 1 , 0 , "init" ) ;
131+ initFnName = initFnName . join ( '_' ) ;
132+
133+ // Does this struct contain an init function? If so then we can create one publicly
134+ // to pass into functions and other structs
135+ file . hasConstructor = structFile . used && structFile . used . needs . some ( function ( fnName ) {
136+ return fnName === initFnName ;
137+ } ) ;
138+
127139 // Doesn't actually exist.
128140 if ( cFile . functions . indexOf ( file . freeFunctionName ) === - 1 ) {
129141 delete file . freeFunctionName ;
@@ -190,6 +202,22 @@ fileNames.forEach(function(fileName, index) {
190202 field . jsFunctionName = camelCase ( field . name ) ;
191203 field . cppClassName = typeMap [ field . cType ] . cpp ;
192204 field . jsClassName = typeMap [ field . cType ] . js ;
205+
206+ var struct = structs [ field . cType ] ;
207+
208+ // This should turn 'git_clone_options' into 'git_clone_init_options'
209+ var initFnName = field . cType . split ( '_' ) ;
210+
211+ initFnName . splice ( - 1 , 0 , "init" ) ;
212+ initFnName = initFnName . join ( '_' ) ;
213+
214+ // Does this struct contain an init function? If so then we can create one publicly
215+ // to pass into functions and other structs
216+ field . hasConstructor = struct && struct . used && struct . used . needs . some ( function ( fnName ) {
217+ return fnName === initFnName ;
218+ } ) ;
219+
220+ field . isEnum = struct && struct . type === "enum" ;
193221 } catch ( ex ) {
194222 console . error ( file . filename , field . cType + " is missing a definition." ) ;
195223 }
0 commit comments