Skip to content

Commit 4d77fe6

Browse files
author
Federico Fissore
committed
Made clearer from where LINE_OFFSET comes from
Signed-off-by: Federico Fissore <[email protected]>
1 parent 90b63a5 commit 4d77fe6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/arduino.cc/builder/sketch_source_merger.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,19 @@ type SketchSourceMerger struct{}
4141
func (s *SketchSourceMerger) Run(context map[string]interface{}) error {
4242
sketch := context[constants.CTX_SKETCH].(*types.Sketch)
4343

44+
lineOffset := 0
4445
includeSection := composeIncludeArduinoSection()
46+
lineOffset += 2
4547
context[constants.CTX_INCLUDE_SECTION] = includeSection
4648

4749
source := includeSection
4850
source += addSourceWrappedWithLineDirective(&sketch.MainFile)
51+
lineOffset += 1
4952
for _, file := range sketch.OtherSketchFiles {
5053
source += addSourceWrappedWithLineDirective(&file)
5154
}
5255

53-
context[constants.CTX_LINE_OFFSET] = 3
56+
context[constants.CTX_LINE_OFFSET] = lineOffset
5457
context[constants.CTX_SOURCE] = source
5558

5659
return nil

0 commit comments

Comments
 (0)