From: Josh Bleecher Snyder Date: Tue, 14 Mar 2017 16:12:55 +0000 (-0700) Subject: cmd/compile: use local fn variable in compile X-Git-Tag: go1.9beta1~1175 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=57107f300a53c0e52bc0a1ff03d52faa628c11e5;p=gostls13.git cmd/compile: use local fn variable in compile 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 Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/compile/internal/gc/pgen.go b/src/cmd/compile/internal/gc/pgen.go index f9375158e2..d67184749f 100644 --- a/src/cmd/compile/internal/gc/pgen.go +++ b/src/cmd/compile/internal/gc/pgen.go @@ -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 } }