File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -48,11 +48,12 @@ func (s *PrototypesAdder) Run(context map[string]interface{}) error {
4848 }
4949
5050 firstFunctionLine := context [constants .CTX_LINE_WHERE_TO_INSERT_PROTOTYPES ].(int )
51- if firstFunctionOutsideOfSource (firstFunctionLine , sourceRows ) {
51+ if isFirstFunctionOutsideOfSource (firstFunctionLine , sourceRows ) {
5252 return nil
5353 }
5454
55- firstFunctionChar := len (strings .Join (sourceRows [:firstFunctionLine + context [constants .CTX_LINE_OFFSET ].(int )- 1 ], "\n " )) + 1
55+ insertionLine := firstFunctionLine + context [constants .CTX_LINE_OFFSET ].(int ) - 1
56+ firstFunctionChar := len (strings .Join (sourceRows [:insertionLine ], "\n " )) + 1
5657 prototypeSection := composePrototypeSection (firstFunctionLine , context [constants .CTX_PROTOTYPES ].([]* types.Prototype ))
5758 context [constants .CTX_PROTOTYPE_SECTION ] = prototypeSection
5859 source = source [:firstFunctionChar ] + prototypeSection + source [firstFunctionChar :]
@@ -96,6 +97,6 @@ func signatureContainsaDefaultArg(proto *types.Prototype) bool {
9697 return strings .Contains (proto .Prototype , "=" )
9798}
9899
99- func firstFunctionOutsideOfSource (firstFunctionLine int , sourceRows []string ) bool {
100+ func isFirstFunctionOutsideOfSource (firstFunctionLine int , sourceRows []string ) bool {
100101 return firstFunctionLine > len (sourceRows )- 1
101102}
You can’t perform that action at this time.
0 commit comments