]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "cmd/compile: properly handle map assignments for OAS2DOTTYPE"
authorMatthew Dempsky <mdempsky@google.com>
Sun, 8 May 2016 19:54:31 +0000 (12:54 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Sun, 8 May 2016 20:15:04 +0000 (20:15 +0000)
This reverts commit 9d7c9b4384db01afd2acb27d3a4636b60e957f08.

For #15602.

Change-Id: I464184b05babe4cb8dedab6161efa730cea6ee2d
Reviewed-on: https://go-review.googlesource.com/22930
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/order.go
test/fixedbugs/issue14678.go [deleted file]

index d432b43460b88fdb2ea6a10a8e6254214679589d..7026ad79efa383caf6b33a102c7ef6a21ff7b5dd 100644 (file)
@@ -569,24 +569,18 @@ func orderstmt(n *Node, order *Order) {
 
                orderexprlist(n.List, order)
                n.Rlist.First().Left = orderexpr(n.Rlist.First().Left, order, nil) // i in i.(T)
-
-               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])
-                       }
+               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()})
                }
-               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,
diff --git a/test/fixedbugs/issue14678.go b/test/fixedbugs/issue14678.go
deleted file mode 100644 (file)
index 94ca86d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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")
-       }
-}