1
0
mirror of https://github.com/golang/go synced 2024-11-19 03:04:42 -07:00

go.tools/go/types: add Package.SetImports

R=adonovan, neelance
CC=golang-dev
https://golang.org/cl/32500043
This commit is contained in:
Robert Griesemer 2013-11-26 09:19:17 -08:00
parent 6cb29d8d47
commit b9c2c88573

View File

@ -38,12 +38,16 @@ func (pkg *Package) Scope() *Scope { return pkg.scope }
// exported objects; otherwise it is incomplete. // exported objects; otherwise it is incomplete.
func (pkg *Package) Complete() bool { return pkg.complete } func (pkg *Package) Complete() bool { return pkg.complete }
// MarkComplete marks a package as complete.
func (pkg *Package) MarkComplete() { pkg.complete = true }
// Imports returns the list of packages explicitly imported by // Imports returns the list of packages explicitly imported by
// pkg; the list is in source order. Package unsafe is excluded. // pkg; the list is in source order. Package unsafe is excluded.
func (pkg *Package) Imports() []*Package { return pkg.imports } func (pkg *Package) Imports() []*Package { return pkg.imports }
// MarkComplete marks a package as complete. // SetImports sets the list of explicitly imported packages to list.
func (pkg *Package) MarkComplete() { pkg.complete = true } // It is the caller's responsibility to make sure list elements are unique.
func (pkg *Package) SetImports(list []*Package) { pkg.imports = list }
func (pkg *Package) String() string { func (pkg *Package) String() string {
return fmt.Sprintf("package %s (%s)", pkg.name, pkg.path) return fmt.Sprintf("package %s (%s)", pkg.name, pkg.path)