aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp/interpreter.go
diff options
context:
space:
mode:
authorDamian Gryski <[email protected]>2022-03-14 14:22:28 -0700
committerRon Evans <[email protected]>2022-03-17 20:06:59 +0100
commit06b19cde2d39c85eb208e26fb223ecea138cbd67 (patch)
tree857995331e8eebebb654c1d3957819d8a54e0b30 /interp/interpreter.go
parent42ae9a665fb171b4e19c55250449801982041e6d (diff)
downloadtinygo-06b19cde2d39c85eb208e26fb223ecea138cbd67.tar.gz
tinygo-06b19cde2d39c85eb208e26fb223ecea138cbd67.zip
interp: prevent an off-by-one during interp debug
Diffstat (limited to 'interp/interpreter.go')
-rw-r--r--interp/interpreter.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/interp/interpreter.go b/interp/interpreter.go
index 8653b6297..1044a2c50 100644
--- a/interp/interpreter.go
+++ b/interp/interpreter.go
@@ -492,9 +492,9 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
// Call a function with a definition available. Run it as usual,
// possibly trying to recover from it if it failed to execute.
if r.debug {
- argStrings := make([]string, len(operands))
- for i := range argStrings {
- argStrings[i] = operands[i+1].String()
+ argStrings := make([]string, len(operands)-1)
+ for i, v := range operands[1:] {
+ argStrings[i] = v.String()
}
fmt.Fprintln(os.Stderr, indent+"call:", callFn.name+"("+strings.Join(argStrings, ", ")+")")
}