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>
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