Skip to content

Commit 2cea6cd

Browse files
committed
cmd/internal/obj: adjust (*Link).AllPos comment in inl.go
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 <[email protected]> Reviewed-by: Keith Randall <[email protected]> Run-TryBot: David Chase <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 7717ac1 commit 2cea6cd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cmd/internal/obj/inl.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ func (ctxt *Link) InnermostPos(xpos src.XPos) src.Pos {
109109
}
110110

111111
// AllPos returns a slice of the positions inlined at xpos, from
112-
// innermost (index zero) to outermost. To avoid gratuitous allocation
113-
// the result is passed in and extended if necessary.
112+
// innermost (index zero) to outermost. To avoid allocation
113+
// the input slice is truncated, and used for the result, extended
114+
// as necessary.
114115
func (ctxt *Link) AllPos(xpos src.XPos, result []src.Pos) []src.Pos {
115116
pos := ctxt.InnermostPos(xpos)
116117
result = result[:0]

0 commit comments

Comments
 (0)