]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: use local fn variable in compile
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 14 Mar 2017 16:12:55 +0000 (09:12 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 14 Mar 2017 17:57:09 +0000 (17:57 +0000)
fn == Curfn in this context. Prefer the local variable.

Passes toolstash -cmp. Updates #15756.

Change-Id: I75b589c682d0c1b524cac2bbf2bba368a6027b06
Reviewed-on: https://go-review.googlesource.com/38151
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/pgen.go

index f9375158e25ec7067925f95b834127e0b3535ad6..d67184749f1c4de5e70092edad5e33ae29b0002f 100644 (file)
@@ -321,7 +321,7 @@ func compile(fn *Node) {
        }(setlineno(fn))
 
        Curfn = fn
-       dowidth(Curfn.Type)
+       dowidth(fn.Type)
 
        if fn.Nbody.Len() == 0 {
                if pure_go || strings.HasPrefix(fn.Func.Nname.Sym.Name, "init.") {
@@ -335,25 +335,25 @@ func compile(fn *Node) {
 
        saveerrors()
 
-       order(Curfn)
+       order(fn)
        if nerrors != 0 {
                return
        }
 
        hasdefer = false
-       walk(Curfn)
+       walk(fn)
        if nerrors != 0 {
                return
        }
        if instrumenting {
-               instrument(Curfn)
+               instrument(fn)
        }
        if nerrors != 0 {
                return
        }
 
        // Build an SSA backend function.
-       ssafn := buildssa(Curfn)
+       ssafn := buildssa(fn)
        if nerrors != 0 {
                return
        }
@@ -363,9 +363,9 @@ func compile(fn *Node) {
        Clearp(pc)
        plist.Firstpc = pc
 
-       setlineno(Curfn)
+       setlineno(fn)
 
-       nam := Curfn.Func.Nname
+       nam := fn.Func.Nname
        if isblank(nam) {
                nam = nil
        }
@@ -402,7 +402,7 @@ func compile(fn *Node) {
        // See test/recover.go for test cases and src/reflect/value.go
        // for the actual functions being considered.
        if myimportpath == "reflect" {
-               if Curfn.Func.Nname.Sym.Name == "callReflect" || Curfn.Func.Nname.Sym.Name == "callMethod" {
+               if fn.Func.Nname.Sym.Name == "callReflect" || fn.Func.Nname.Sym.Name == "callMethod" {
                        ptxt.From3.Offset |= obj.WRAPPER
                }
        }