From 1603a6f3eef36931395538ae58d93646877347fe Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 17 Jun 2020 09:59:15 +0200 Subject: [PATCH] op: add note that Ops.Reset invalidates recorded macros. Signed-off-by: Elias Naur --- op/op.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/op/op.go b/op/op.go index 1cd3b1bc..82f1457a 100644 --- a/op/op.go +++ b/op/op.go @@ -162,7 +162,8 @@ func (s StackOp) Pop() { data[0] = byte(opconst.TypePop) } -// Reset the Ops, preparing it for re-use. +// Reset the Ops, preparing it for re-use. Reset invalidates +// any recorded macros. func (o *Ops) Reset() { o.stackStack = stack{} o.macroStack = stack{} @@ -236,7 +237,9 @@ func (m MacroOp) fill() { bo.PutUint32(data[5:], uint32(pc.refs)) } -// Add the recorded list of operations. +// Add the recorded list of operations. Add +// panics if the Ops containing the recording +// has been reset. func (c CallOp) Add(o *Ops) { if c.ops == nil { return