mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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:
parent
aa6b75dd7d
commit
4170084ad1
1 changed files with 6 additions and 6 deletions
|
|
@ -268,14 +268,14 @@ func PkgFuncName(f *Func) string {
|
||||||
s := f.Sym()
|
s := f.Sym()
|
||||||
pkg := s.Pkg
|
pkg := s.Pkg
|
||||||
|
|
||||||
p := base.Ctxt.Pkgpath
|
// TODO(mdempsky): Remove after submitting CL 393715? This matches
|
||||||
if pkg != nil && pkg.Path != "" {
|
// how PkgFuncName has historically handled local functions, but
|
||||||
p = pkg.Path
|
// drchase points out it contradicts the documentation.
|
||||||
}
|
if pkg == types.LocalPkg {
|
||||||
if p == "" {
|
|
||||||
return s.Name
|
return s.Name
|
||||||
}
|
}
|
||||||
return p + "." + s.Name
|
|
||||||
|
return pkg.Path + "." + s.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
var CurFunc *Func
|
var CurFunc *Func
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue