File tree 1 file changed +4
-3
lines changed
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 {
48
48
}
49
49
50
50
firstFunctionLine := context [constants .CTX_LINE_WHERE_TO_INSERT_PROTOTYPES ].(int )
51
- if firstFunctionOutsideOfSource (firstFunctionLine , sourceRows ) {
51
+ if isFirstFunctionOutsideOfSource (firstFunctionLine , sourceRows ) {
52
52
return nil
53
53
}
54
54
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
56
57
prototypeSection := composePrototypeSection (firstFunctionLine , context [constants .CTX_PROTOTYPES ].([]* types.Prototype ))
57
58
context [constants .CTX_PROTOTYPE_SECTION ] = prototypeSection
58
59
source = source [:firstFunctionChar ] + prototypeSection + source [firstFunctionChar :]
@@ -96,6 +97,6 @@ func signatureContainsaDefaultArg(proto *types.Prototype) bool {
96
97
return strings .Contains (proto .Prototype , "=" )
97
98
}
98
99
99
- func firstFunctionOutsideOfSource (firstFunctionLine int , sourceRows []string ) bool {
100
+ func isFirstFunctionOutsideOfSource (firstFunctionLine int , sourceRows []string ) bool {
100
101
return firstFunctionLine > len (sourceRows )- 1
101
102
}
You can’t perform that action at this time.
0 commit comments