AllPos truncates and overwrites its slice-storage input instead
of appending. This makes that clear.
Change-Id: I81653ff49a4a7d14fe9446fd6620943f3b20bbd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/449478
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
}
// AllPos returns a slice of the positions inlined at xpos, from
-// innermost (index zero) to outermost. To avoid gratuitous allocation
-// the result is passed in and extended if necessary.
+// innermost (index zero) to outermost. To avoid allocation
+// the input slice is truncated, and used for the result, extended
+// as necessary.
func (ctxt *Link) AllPos(xpos src.XPos, result []src.Pos) []src.Pos {
pos := ctxt.InnermostPos(xpos)
result = result[:0]