From b9c2c88573f823f55606b9d5833bd85915ba64f9 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 26 Nov 2013 09:19:17 -0800 Subject: [PATCH] go.tools/go/types: add Package.SetImports R=adonovan, neelance CC=golang-dev https://golang.org/cl/32500043 --- go/types/package.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/go/types/package.go b/go/types/package.go index dc6c78ea5f7..7090c17eb29 100644 --- a/go/types/package.go +++ b/go/types/package.go @@ -38,12 +38,16 @@ func (pkg *Package) Scope() *Scope { return pkg.scope } // exported objects; otherwise it is incomplete. 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 // pkg; the list is in source order. Package unsafe is excluded. func (pkg *Package) Imports() []*Package { return pkg.imports } -// MarkComplete marks a package as complete. -func (pkg *Package) MarkComplete() { pkg.complete = true } +// SetImports sets the list of explicitly imported packages to list. +// 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 { return fmt.Sprintf("package %s (%s)", pkg.name, pkg.path)