mirror of
https://github.com/golang/go
synced 2024-11-19 14:34:42 -07:00
cmd/compile: set hiter type for map iterator in order pass
Previously the type was first set to uint8 and then corrected later in walkrange. Change-Id: I9e4b597710e8a5fad39dde035df85676bc8d2874 Reviewed-on: https://go-review.googlesource.com/61032 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
bb31217579
commit
9c3f268558
@ -762,8 +762,9 @@ func orderstmt(n *Node, order *Order) {
|
||||
r := n.Right
|
||||
n.Right = ordercopyexpr(r, r.Type, order, 0)
|
||||
|
||||
// n->alloc is the temp for the iterator.
|
||||
prealloc[n] = ordertemp(types.Types[TUINT8], order, true)
|
||||
// prealloc[n] is the temp for the iterator.
|
||||
// hiter contains pointers and needs to be zeroed.
|
||||
prealloc[n] = ordertemp(hiter(n.Type), order, true)
|
||||
}
|
||||
for i := range n.List.Slice() {
|
||||
n.List.SetIndex(i, orderexprinplace(n.List.Index(i), order))
|
||||
|
@ -249,9 +249,8 @@ func walkrange(n *Node) *Node {
|
||||
// we only use a once, so no copy needed.
|
||||
ha := a
|
||||
|
||||
th := hiter(t)
|
||||
hit := prealloc[n]
|
||||
hit.Type = th
|
||||
th := hit.Type
|
||||
n.Left = nil
|
||||
keysym := th.Field(0).Sym // depends on layout of iterator struct. See reflect.go:hiter
|
||||
valsym := th.Field(1).Sym // ditto
|
||||
|
Loading…
Reference in New Issue
Block a user