From: Cuong Manh Le Date: Tue, 16 Jul 2024 17:55:11 +0000 (+0700) Subject: cmd/compile: simplify outerfn check in closureName X-Git-Tag: go1.24rc1~1435 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2edf00cf0d19cfb737cce0901f348974a7dbaa53;p=gostls13.git cmd/compile: simplify outerfn check in closureName Since CL 523275, outerfn is always non-nil. Change-Id: I42cfff90546e506e04a74fb4f754a25f1eadddc9 Reviewed-on: https://go-review.googlesource.com/c/go/+/598636 Reviewed-by: Than McIntosh Auto-Submit: Cuong Manh Le Reviewed-by: Keith Randall Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI --- diff --git a/src/cmd/compile/internal/ir/func.go b/src/cmd/compile/internal/ir/func.go index 3c4ec4a64f..9c7ba97eb5 100644 --- a/src/cmd/compile/internal/ir/func.go +++ b/src/cmd/compile/internal/ir/func.go @@ -421,7 +421,7 @@ var globClosgen int32 // closureName generates a new unique name for a closure within outerfn at pos. func closureName(outerfn *Func, pos src.XPos, why Op) *types.Sym { - if outerfn != nil && outerfn.OClosure != nil && outerfn.OClosure.Func.RangeParent != nil { + if outerfn.OClosure != nil && outerfn.OClosure.Func.RangeParent != nil { outerfn = outerfn.OClosure.Func.RangeParent } pkg := types.LocalPkg @@ -431,7 +431,7 @@ func closureName(outerfn *Func, pos src.XPos, why Op) *types.Sym { default: base.FatalfAt(pos, "closureName: bad Op: %v", why) case OCLOSURE: - if outerfn == nil || outerfn.OClosure == nil { + if outerfn.OClosure == nil { suffix = ".func" } case ORANGE: @@ -446,7 +446,7 @@ func closureName(outerfn *Func, pos src.XPos, why Op) *types.Sym { // There may be multiple functions named "_". In those // cases, we can't use their individual Closgens as it // would lead to name clashes. - if outerfn != nil && !IsBlank(outerfn.Nname) { + if !IsBlank(outerfn.Nname) { pkg = outerfn.Sym().Pkg outer = FuncName(outerfn)