]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: superficial cleanup in maplit
authorJosh Bleecher Snyder <josharian@gmail.com>
Sun, 28 Feb 2016 22:39:38 +0000 (14:39 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 29 Feb 2016 02:17:58 +0000 (02:17 +0000)
Mostly renaming variables for clarity.

Passes toolstash -cmp.

Change-Id: I9867137c34c14985cbbbdb2d34fbbe4cc65cb6fb
Reviewed-on: https://go-review.googlesource.com/20023
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/sinit.go

index c6647cc7f56310d838f4055b80b23eeaef816a5e..12bdfbada5a76cf41c981582fd0e4db278c202af 100644 (file)
@@ -868,8 +868,7 @@ func maplit(ctxt int, n *Node, var_ *Node, init **NodeList) {
        litas(var_, a, init)
 
        // count the initializers
-       b := int64(0)
-
+       b := 0
        for l := n.List; l != nil; l = l.Next {
                r := l.N
                if r.Op != OKEY {
@@ -886,35 +885,32 @@ func maplit(ctxt int, n *Node, var_ *Node, init **NodeList) {
        if b != 0 {
                // build type [count]struct { a Tindex, b Tvalue }
                t := n.Type
-
                tk := t.Down
                tv := t.Type
 
                symb := Lookup("b")
-               = typ(TFIELD)
-               t.Type = tv
-               t.Sym = symb
+               fieldb := typ(TFIELD)
+               fieldb.Type = tv
+               fieldb.Sym = symb
 
                syma := Lookup("a")
-               t1 := t
-               t = typ(TFIELD)
-               t.Type = tk
-               t.Sym = syma
-               t.Down = t1
+               fielda := typ(TFIELD)
+               fielda.Type = tk
+               fielda.Sym = syma
+               fielda.Down = fieldb
 
-               t1 = t
-               t = typ(TSTRUCT)
-               t.Type = t1
+               tstruct := typ(TSTRUCT)
+               tstruct.Type = fielda
 
-               t1 = t
-               t = typ(TARRAY)
-               t.Bound = b
-               t.Type = t1
+               tarr := typ(TARRAY)
+               tarr.Bound = int64(b)
+               tarr.Type = tstruct
 
-               dowidth(t)
+               // TODO(josharian): suppress alg generation for these types?
+               dowidth(tarr)
 
                // make and initialize static array
-               vstat := staticname(t, ctxt)
+               vstat := staticname(tarr, ctxt)
 
                b := int64(0)
                for l := n.List; l != nil; l = l.Next {
@@ -976,7 +972,7 @@ func maplit(ctxt int, n *Node, var_ *Node, init **NodeList) {
                a.Nbody.Set([]*Node{r})
 
                a.Ninit = list1(Nod(OAS, index, Nodintconst(0)))
-               a.Left = Nod(OLT, index, Nodintconst(t.Bound))
+               a.Left = Nod(OLT, index, Nodintconst(tarr.Bound))
                a.Right = Nod(OAS, index, Nod(OADD, index, Nodintconst(1)))
 
                typecheck(&a, Etop)
@@ -985,9 +981,7 @@ func maplit(ctxt int, n *Node, var_ *Node, init **NodeList) {
        }
 
        // put in dynamic entries one-at-a-time
-       var key *Node
-
-       var val *Node
+       var key, val *Node
        for l := n.List; l != nil; l = l.Next {
                r := l.N