go/ssa: update public doc of CreatePackage

Change-Id: I6ae61513717bac0bd756b612f0a843d55f1df296
GitHub-Last-Rev: 734464cdb3
GitHub-Pull-Request: golang/tools#520
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613159
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
xieyuschen 2024-09-16 17:10:49 +00:00 коммит произвёл Tim King
Родитель bea7373d8a
Коммит 8db95625fc
2 изменённых файлов: 1 добавлений и 5 удалений

Просмотреть файл

@ -193,11 +193,7 @@ func membersFromDecl(pkg *Package, decl ast.Decl, goversion string) {
//
// The real work of building SSA form for each function is not done
// until a subsequent call to Package.Build.
//
// CreatePackage should not be called after building any package in
// the program.
func (prog *Program) CreatePackage(pkg *types.Package, files []*ast.File, info *types.Info, importable bool) *Package {
// TODO(adonovan): assert that no package has yet been built.
if pkg == nil {
panic("nil pkg") // otherwise pkg.Scope below returns types.Universe!
}

Просмотреть файл

@ -342,7 +342,7 @@ type Function struct {
// source information
Synthetic string // provenance of synthetic function; "" for true source functions
syntax ast.Node // *ast.Func{Decl,Lit}, if from syntax (incl. generic instances) or (*ast.RangeStmt if a yield function)
info *types.Info // type annotations (iff syntax != nil)
info *types.Info // type annotations (if syntax != nil)
goversion string // Go version of syntax (NB: init is special)
parent *Function // enclosing function if anon; nil if global