]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: simplify outerfn check in closureName
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 16 Jul 2024 17:55:11 +0000 (00:55 +0700)
committerGopher Robot <gobot@golang.org>
Mon, 22 Jul 2024 21:27:57 +0000 (21:27 +0000)
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 <thanm@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/compile/internal/ir/func.go

index 3c4ec4a64f47a4fa0692a47a6e20752e2fe88d8e..9c7ba97eb5d22453b3901b0626180a853b94e122 100644 (file)
@@ -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)