Skip to content

Commit ffccf01

Browse files
dgryskideadprogram
authored andcommitted
interp: prevent an off-by-one during interp debug
1 parent 41117cc commit ffccf01

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

interp/interpreter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,9 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
492492
// Call a function with a definition available. Run it as usual,
493493
// possibly trying to recover from it if it failed to execute.
494494
if r.debug {
495-
argStrings := make([]string, len(operands))
496-
for i := range argStrings {
497-
argStrings[i] = operands[i+1].String()
495+
argStrings := make([]string, len(operands)-1)
496+
for i, v := range operands[1:] {
497+
argStrings[i] = v.String()
498498
}
499499
fmt.Fprintln(os.Stderr, indent+"call:", callFn.name+"("+strings.Join(argStrings, ", ")+")")
500500
}

0 commit comments

Comments
 (0)