cmd/internal/obj: add Func type to replace "curfn any"

This adds a modicum of type safety to these APIs, which are otherwise
quite confusing to follow.

Change-Id: I268a9a1a99a47dcfef6dc1e9e5be13673af3fb85
Reviewed-on: https://go-review.googlesource.com/c/go/+/523396
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Matthew Dempsky 2023-08-28 05:43:51 -07:00 committed by Gopher Robot
parent 98c26afa8c
commit ad74bc4a92
4 changed files with 18 additions and 15 deletions

View file

@ -23,7 +23,7 @@ import (
"cmd/internal/src"
)
func Info(fnsym *obj.LSym, infosym *obj.LSym, curfn interface{}) (scopes []dwarf.Scope, inlcalls dwarf.InlCalls, startPos src.XPos) {
func Info(fnsym *obj.LSym, infosym *obj.LSym, curfn obj.Func) (scopes []dwarf.Scope, inlcalls dwarf.InlCalls) {
fn := curfn.(*ir.Func)
if fn.Nname != nil {
@ -128,7 +128,7 @@ func Info(fnsym *obj.LSym, infosym *obj.LSym, curfn interface{}) (scopes []dwarf
if base.Flag.GenDwarfInl > 0 {
inlcalls = assembleInlines(fnsym, dwarfVars)
}
return scopes, inlcalls, fn.Pos()
return scopes, inlcalls
}
func declPos(decl *ir.Name) src.XPos {