From 2edf00cf0d19cfb737cce0901f348974a7dbaa53 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Wed, 17 Jul 2024 00:55:11 +0700 Subject: [PATCH] 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 --- src/cmd/compile/internal/ir/func.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) -- 2.48.1