mirror of
https://github.com/golang/go
synced 2024-11-23 20:50:04 -07:00
go/types: return Universe for (*Package)(nil).Scope()
Port of go.dev/cl/325469. Fixes #46594. Change-Id: I4bcdafecaa86885360599c204678871646bb221b Reviewed-on: https://go-review.googlesource.com/c/go/+/385997 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
1cb34fbb26
commit
6e49c592de
@ -39,7 +39,13 @@ func (pkg *Package) SetName(name string) { pkg.name = name }
|
|||||||
// Scope returns the (complete or incomplete) package scope
|
// Scope returns the (complete or incomplete) package scope
|
||||||
// holding the objects declared at package level (TypeNames,
|
// holding the objects declared at package level (TypeNames,
|
||||||
// Consts, Vars, and Funcs).
|
// Consts, Vars, and Funcs).
|
||||||
func (pkg *Package) Scope() *Scope { return pkg.scope }
|
// For a nil pkg receiver, Scope returns the Universe scope.
|
||||||
|
func (pkg *Package) Scope() *Scope {
|
||||||
|
if pkg != nil {
|
||||||
|
return pkg.scope
|
||||||
|
}
|
||||||
|
return Universe
|
||||||
|
}
|
||||||
|
|
||||||
// A package is complete if its scope contains (at least) all
|
// A package is complete if its scope contains (at least) all
|
||||||
// exported objects; otherwise it is incomplete.
|
// exported objects; otherwise it is incomplete.
|
||||||
|
Loading…
Reference in New Issue
Block a user