]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: reduce stutter
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 23 Mar 2016 15:51:38 +0000 (08:51 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 24 Mar 2016 01:17:23 +0000 (01:17 +0000)
This is follow-up 1 of 3 to CL 20959.

Passes toolstash -cmp.

Change-Id: I9bddf7d88333fa4755e03ff8a034a35bd01b7855
Reviewed-on: https://go-review.googlesource.com/21052
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/const.go
src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/export.go
src/cmd/compile/internal/gc/inl.go

index 46b263fb8e7e472d9b1fa177aaaa2f08f12cc17e..194c028a62fa7ed38d75ca2a3ec0daabaef3c4a2 100644 (file)
@@ -457,9 +457,7 @@ func walkclosure(func_ *Node, init *Nodes) *Node {
                delete(prealloc, func_)
        }
 
-       clos = walkexpr(clos, init)
-
-       return clos
+       return walkexpr(clos, init)
 }
 
 func typecheckpartialcall(fn *Node, sym *Sym) {
@@ -662,7 +660,5 @@ func walkpartialcall(n *Node, init *Nodes) *Node {
                delete(prealloc, n)
        }
 
-       clos = walkexpr(clos, init)
-
-       return clos
+       return walkexpr(clos, init)
 }
index b09fc2215e940df4fcbafbdda956b3decac6df45..012de65e632af493e3951d7f6ac4b2c135c1b895 100644 (file)
@@ -143,8 +143,7 @@ func convlit1(n *Node, t *Type, explicit bool) *Node {
                // target is invalid type for a constant?  leave alone.
        case OLITERAL:
                if !okforconst[t.Etype] && n.Type.Etype != TNIL {
-                       n = defaultlit(n, nil)
-                       return n
+                       return defaultlit(n, nil)
                }
 
        case OLSH, ORSH:
@@ -204,9 +203,7 @@ func convlit1(n *Node, t *Type, explicit bool) *Node {
                        n.Type = t
                        return n
                }
-
-               n = defaultlit(n, nil)
-               return n
+               return defaultlit(n, nil)
        }
 
        switch ct {
@@ -1264,8 +1261,7 @@ func defaultlit(n *Node, t *Type) *Node {
        switch ctype {
        default:
                if t != nil {
-                       n = convlit(n, t)
-                       return n
+                       return convlit(n, t)
                }
 
                if n.Val().Ctype() == CTNIL {
index 037ddf48221a4cac98d0e9c00930dcb21d89fa28..20e03f5cd9d22fcf212fc4546fececdb22a19a15 100644 (file)
@@ -902,12 +902,11 @@ func esc(e *EscState, n *Node, up *Node) {
 
                // Link addresses of captured variables to closure.
        case OCLOSURE:
-               var a *Node
                for _, v := range n.Func.Cvars.Slice() {
                        if v.Op == OXXX { // unnamed out argument; see dcl.go:/^funcargs
                                continue
                        }
-                       a = v.Name.Param.Closure
+                       a := v.Name.Param.Closure
                        if !v.Name.Byval {
                                a = Nod(OADDR, a, nil)
                                a.Lineno = v.Lineno
index d1ec784e937a55fa5bad6ab0961775fe8defa6ac..b814a4c46922ff6f412225715509c2b709ea7557 100644 (file)
@@ -225,8 +225,7 @@ func reexportdep(n *Node) {
 }
 
 func dumpexportconst(s *Sym) {
-       n := s.Def
-       n = typecheck(n, Erv)
+       n := typecheck(s.Def, Erv)
        if n == nil || n.Op != OLITERAL {
                Fatalf("dumpexportconst: oconst nil: %v", s)
        }
index fa4dfb33f242f9e56dafb1368ff84faf6a5a643c..ce0b6c38d80c15bc57291d58012e148d43470162 100644 (file)
@@ -292,8 +292,7 @@ func inlconv2stmt(n *Node) {
 //     n.Left = inlconv2expr(n.Left)
 func inlconv2expr(n *Node) *Node {
        r := n.Rlist.First()
-       r = addinit(r, append(n.Ninit.Slice(), n.Nbody.Slice()...))
-       return r
+       return addinit(r, append(n.Ninit.Slice(), n.Nbody.Slice()...))
 }
 
 // Turn the rlist (with the return values) of the OINLCALL in
@@ -509,8 +508,7 @@ func tinlvar(t *Field) *Node {
                return t.Nname.Name.Inlvar
        }
 
-       nblank = typecheck(nblank, Erv|Easgn)
-       return nblank
+       return typecheck(nblank, Erv|Easgn)
 }
 
 var inlgen int