@@ -253,18 +253,13 @@ func getFunctionNodes(content string, treeCursor *sitter.TreeCursor, parser *a.P
253
253
policy *types2.ProofRegisterPolicy)
254
254
(<-chan *types2.RequestEvent, error){...}
255
255
*********
256
- First iteration through children nodes:
257
- Child.Type = method_declaration
258
- Child.Value = whole function body func(*x)(a,b)c{...}
259
-
260
- child.Child(1) is a first part of function declaration, and has type of parameter_list: (e *ProofEventStream)
261
- child.Child(2): has type of field_identifier and represents function's name: ListenProofEvent
262
- child.Child(3): has type parameter_list and represents input parameters: (ctx context.Context, policy *types2.ProofRegisterPolicy)
263
- child.Child(4): has type parameter_list and represent return parameters: (<-chan *types2.RequestEvent, error)
256
+ child.Child(1) is a first part of function declaration (e *ProofEventStream)
257
+ child.Child(2): field_identifier 'ListenProofEvent'
258
+ child.Child(3): parameter_list: (ctx context.Context, policy *types2.ProofRegisterPolicy)
259
+ child.Child(4): parameter_list: (<-chan *types2.RequestEvent, error)
264
260
*/
265
261
if child .Type () == string (METHOD_DECLARATION ) {
266
262
funcName = content [child .Child (2 ).StartByte ():child .Child (2 ).EndByte ()]
267
- public := unicode .IsUpper (rune (funcName [0 ]))
268
263
params := ""
269
264
returnValues := ""
270
265
if child .Child (1 ).Type () == string (PARAMETER_LIST ) {
@@ -275,7 +270,7 @@ func getFunctionNodes(content string, treeCursor *sitter.TreeCursor, parser *a.P
275
270
Node : child ,
276
271
Function : c.FunctionAnnotation {
277
272
Name : funcName ,
278
- Public : public ,
273
+ Public : isPublic ( funcName ) ,
279
274
InputParams : params ,
280
275
ReturnValues : returnValues ,
281
276
},
@@ -381,3 +376,7 @@ func parseContentForFunctions(content string, cursor *sitter.TreeCursor) ([]c.Fu
381
376
382
377
return fnsAnno , nil
383
378
}
379
+
380
+ func isPublic (funcName string ) bool {
381
+ return unicode .IsUpper (rune (funcName [0 ]))
382
+ }
0 commit comments