orderexprlist(n.List, order)
n.Rlist.First().Left = orderexpr(n.Rlist.First().Left, order, nil) // i in i.(T)
- if isblank(n.List.First()) {
- order.out = append(order.out, n)
- } else {
- typ := n.Rlist.First().Type
- tmp1 := ordertemp(typ, order, haspointers(typ))
- order.out = append(order.out, n)
- r := Nod(OAS, n.List.First(), tmp1)
- r = typecheck(r, Etop)
- ordermapassign(r, order)
- n.List.Set([]*Node{tmp1, n.List.Second()})
+
+ results := n.List.Slice()
+ var assigns [2]*Node
+
+ for r, res := range results {
+ if !isblank(res) {
+ results[r] = ordertemp(res.Type, order, haspointers(res.Type))
+ assigns[r] = Nod(OAS, res, results[r])
+ }
}
+ order.out = append(order.out, n)
+ for _, assign := range assigns {
+ if assign != nil {
+ assign = typecheck(assign, Etop)
+ ordermapassign(assign, order)
+ }
+ }
cleantemp(t, order)
// Special: use temporary variables to hold result,
--- /dev/null
+// run
+
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+func main() {
+ m := make(map[int]bool)
+ i := interface{}(1)
+ var v int
+
+ // Ensure map is updated properly
+ _, m[1] = i.(int)
+ v, m[2] = i.(int)
+
+ if v != 1 {
+ panic("fail: v should be 1")
+ }
+ if m[1] == false {
+ panic("fail: m[1] should be true")
+ }
+ if m[2] == false {
+ panic("fail: m[2] should be true")
+ }
+}