mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: add clear(x) builtin
To clear map, and zero content of slice. Updates #56351 Change-Id: I5f81dfbc465500f5acadaf2c6beb9b5f0d2c4045 Reviewed-on: https://go-review.googlesource.com/c/go/+/453395 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
parent
bb4ea80bef
commit
b89a840d65
17 changed files with 256 additions and 142 deletions
|
|
@ -279,6 +279,10 @@ func walkExpr1(n ir.Node, init *ir.Nodes) ir.Node {
|
|||
case ir.OCOPY:
|
||||
return walkCopy(n.(*ir.BinaryExpr), init, base.Flag.Cfg.Instrumenting && !base.Flag.CompilingRuntime)
|
||||
|
||||
case ir.OCLEAR:
|
||||
n := n.(*ir.UnaryExpr)
|
||||
return walkClear(n)
|
||||
|
||||
case ir.OCLOSE:
|
||||
n := n.(*ir.UnaryExpr)
|
||||
return walkClose(n, init)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue