diff options
| author | Matthew Dempsky <mdempsky@google.com> | 2023-08-23 13:52:25 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-08-24 07:17:27 +0000 |
| commit | d5c5808534f0ad97333b1fd5fff81998f44986fe (patch) | |
| tree | 5fb63e5dd9910566ecf7f86fca171e95d20fe61c /src/syscall/exec_linux_test.go | |
| parent | 43e69b330a71e0d101bd57f0a1ea83bc4da259f3 (diff) | |
| download | go-d5c5808534f0ad97333b1fd5fff81998f44986fe.tar.xz | |
cmd/compile/internal/syntax: add Unparen and UnpackListExpr helpers
We've added Unparen to go/ast, so add syntax.Unparen to be
consistent (and because it's similarly useful).
Also, types2 and noder both have similar functions for unpacking
ListExprs, so might as well add a common implementation in package
syntax too.
Finally, addressing the TODO: UnpackListExpr is small enough to be
inlined (when default optimizations are enabled), and for typical uses
of UnpackListExpr (e.g., "range UnpackListExpr(x)") the single-element
slice result is stack allocated in the caller. This CL adds a test
using testing.AllocsPerRun to ensure this remains so in the future.
Change-Id: I96a5591d202193ed5bf1ce6f290919107e3dc01b
Reviewed-on: https://go-review.googlesource.com/c/go/+/522336
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/syscall/exec_linux_test.go')
0 files changed, 0 insertions, 0 deletions
