Update go version
This commit is contained in:
54
vendor/golang.org/x/tools/go/ssa/create.go
generated
vendored
54
vendor/golang.org/x/tools/go/ssa/create.go
generated
vendored
@@ -15,7 +15,6 @@ import (
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/tools/internal/ssainternal"
|
||||
"golang.org/x/tools/internal/versions"
|
||||
)
|
||||
|
||||
@@ -116,33 +115,26 @@ func memberFromObject(pkg *Package, obj types.Object, syntax ast.Node, goversion
|
||||
func createFunction(prog *Program, obj *types.Func, name string, syntax ast.Node, info *types.Info, goversion string) *Function {
|
||||
sig := obj.Type().(*types.Signature)
|
||||
|
||||
// Collect type parameters.
|
||||
var tparams *types.TypeParamList
|
||||
if rtparams := sig.RecvTypeParams(); rtparams.Len() > 0 {
|
||||
tparams = rtparams // method of generic type
|
||||
} else if sigparams := sig.TypeParams(); sigparams.Len() > 0 {
|
||||
tparams = sigparams // generic function
|
||||
}
|
||||
|
||||
/* declared function/method (from syntax or export data) */
|
||||
fn := &Function{
|
||||
name: name,
|
||||
object: obj,
|
||||
Signature: sig,
|
||||
build: (*builder).buildFromSyntax,
|
||||
syntax: syntax,
|
||||
info: info,
|
||||
goversion: goversion,
|
||||
pos: obj.Pos(),
|
||||
Pkg: nil, // may be set by caller
|
||||
Prog: prog,
|
||||
typeparams: tparams,
|
||||
name: name,
|
||||
object: obj,
|
||||
Signature: sig,
|
||||
build: (*builder).buildFromSyntax,
|
||||
syntax: syntax,
|
||||
info: info,
|
||||
goversion: goversion,
|
||||
pos: obj.Pos(),
|
||||
Pkg: nil, // may be set by caller
|
||||
Prog: prog,
|
||||
recvtypeparams: sig.RecvTypeParams(),
|
||||
typeparams: sig.TypeParams(),
|
||||
}
|
||||
if fn.syntax == nil {
|
||||
fn.Synthetic = "from type information"
|
||||
fn.build = (*builder).buildParamsOnly
|
||||
}
|
||||
if tparams.Len() > 0 {
|
||||
if fn.hasTypeParams() {
|
||||
fn.generic = new(generic)
|
||||
}
|
||||
return fn
|
||||
@@ -314,19 +306,13 @@ func (prog *Program) ImportedPackage(path string) *Package {
|
||||
return prog.imported[path]
|
||||
}
|
||||
|
||||
// setNoReturn sets the predicate used by the SSA builder to decide
|
||||
// whether a call to the specified named function cannot return,
|
||||
// allowing the builder to prune control-flow edges following the
|
||||
// call, thus improving the precision of downstream analysis.
|
||||
// SetNoReturn sets the predicate used when building the ssa.Program
|
||||
// prog that reports whether a given function cannot return.
|
||||
// This may be used to prune spurious control flow edges
|
||||
// after (e.g.) log.Fatal, improving the precision of analyses.
|
||||
//
|
||||
// TODO(adonovan): add (*Program).SetNoReturn to the public API.
|
||||
func (prog *Program) setNoReturn(noReturn func(*types.Func) bool) {
|
||||
// A typical implementation is the [ctrlflow.CFGs.NoReturn] method from
|
||||
// [golang.org/x/tools/go/analysis/passes/ctrlflow].
|
||||
func (prog *Program) SetNoReturn(noReturn func(*types.Func) bool) {
|
||||
prog.noReturn = noReturn
|
||||
}
|
||||
|
||||
func init() {
|
||||
// SetNoReturn exposes Program.setNoReturn to the buildssa analyzer.
|
||||
ssainternal.SetNoReturn = func(prog any, noReturn func(*types.Func) bool) {
|
||||
prog.(*Program).setNoReturn(noReturn)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user