Skip to content

Commit 57107f3

Browse files
committed
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 <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent ccae744 commit 57107f3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/cmd/compile/internal/gc/pgen.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func compile(fn *Node) {
321321
}(setlineno(fn))
322322

323323
Curfn = fn
324-
dowidth(Curfn.Type)
324+
dowidth(fn.Type)
325325

326326
if fn.Nbody.Len() == 0 {
327327
if pure_go || strings.HasPrefix(fn.Func.Nname.Sym.Name, "init.") {
@@ -335,25 +335,25 @@ func compile(fn *Node) {
335335

336336
saveerrors()
337337

338-
order(Curfn)
338+
order(fn)
339339
if nerrors != 0 {
340340
return
341341
}
342342

343343
hasdefer = false
344-
walk(Curfn)
344+
walk(fn)
345345
if nerrors != 0 {
346346
return
347347
}
348348
if instrumenting {
349-
instrument(Curfn)
349+
instrument(fn)
350350
}
351351
if nerrors != 0 {
352352
return
353353
}
354354

355355
// Build an SSA backend function.
356-
ssafn := buildssa(Curfn)
356+
ssafn := buildssa(fn)
357357
if nerrors != 0 {
358358
return
359359
}
@@ -363,9 +363,9 @@ func compile(fn *Node) {
363363
Clearp(pc)
364364
plist.Firstpc = pc
365365

366-
setlineno(Curfn)
366+
setlineno(fn)
367367

368-
nam := Curfn.Func.Nname
368+
nam := fn.Func.Nname
369369
if isblank(nam) {
370370
nam = nil
371371
}
@@ -402,7 +402,7 @@ func compile(fn *Node) {
402402
// See test/recover.go for test cases and src/reflect/value.go
403403
// for the actual functions being considered.
404404
if myimportpath == "reflect" {
405-
if Curfn.Func.Nname.Sym.Name == "callReflect" || Curfn.Func.Nname.Sym.Name == "callMethod" {
405+
if fn.Func.Nname.Sym.Name == "callReflect" || fn.Func.Nname.Sym.Name == "callMethod" {
406406
ptxt.From3.Offset |= obj.WRAPPER
407407
}
408408
}

0 commit comments

Comments
 (0)