1
0
mirror of https://github.com/golang/go synced 2024-11-23 20:20:01 -07:00

cmd/compile/internal/ir: remove PkgFuncName assumption that LocalPkg.Path == ""

Prep refactoring for CL 393715, after which LocalPkg.Path will no
longer be the empty string. Instead of testing `pkg.Path == ""`, we
can just test `pkg == LocalPkg`.

Updates #51734.

Change-Id: I74fff7fb383e275c9f294389d30b2220aced19e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/406059
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Matthew Dempsky 2022-05-12 15:47:21 -07:00
parent aa6b75dd7d
commit 4170084ad1

View File

@ -268,14 +268,14 @@ func PkgFuncName(f *Func) string {
s := f.Sym()
pkg := s.Pkg
p := base.Ctxt.Pkgpath
if pkg != nil && pkg.Path != "" {
p = pkg.Path
}
if p == "" {
// TODO(mdempsky): Remove after submitting CL 393715? This matches
// how PkgFuncName has historically handled local functions, but
// drchase points out it contradicts the documentation.
if pkg == types.LocalPkg {
return s.Name
}
return p + "." + s.Name
return pkg.Path + "." + s.Name
}
var CurFunc *Func