Help us shape the future of Go! Take the 2026 Go Developer Survey

ssautil

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSSA

func BuildSSA(pkg *packages.Package) (*buildssa.SSA, error)

BuildSSA See: buildssa.Analyzer.

func GetPosition

func GetPosition(pkg *ssa.Package, pos ...token.Pos) token.Position

func InstrToCallCommon

func InstrToCallCommon(instr ssa.Instruction) (*ssa.CallCommon, bool)

func LoadBuildSSAs

func LoadBuildSSAs(dir string, patterns ...string) ([]*buildssa.SSA, error)

func LoadInstrs

func LoadInstrs(dir string, patterns ...string) ([]ssa.Instruction, error)

func Unquote

func Unquote(str string) (string, error)

func ValueToCallCommon

func ValueToCallCommon(value ssa.Value) (*ssa.CallCommon, bool)

func ValueToConsts

func ValueToConsts[T any](v ssa.Value, flattener ToConstsFunc[T], mapper func(t *ssa.Const) (T, bool)) ([]T, bool)

func ValueToConstsWithMaxDepth

func ValueToConstsWithMaxDepth[T any](v ssa.Value, maxDepth int, flattener ToConstsFunc[T], mapper func(t *ssa.Const) (T, bool)) ([]T, bool)

func ValueToInts

func ValueToInts(v ssa.Value) ([]int, bool)

func ValueToIntsWithMaxDepth

func ValueToIntsWithMaxDepth(v ssa.Value, maxDepth int) ([]int, bool)

func ValueToStrings

func ValueToStrings(v ssa.Value) ([]string, bool)

func ValueToStringsWithMaxDepth

func ValueToStringsWithMaxDepth(v ssa.Value, maxDepth int) ([]string, bool)

Types

type BuiltinDynamicMethodCall

type BuiltinDynamicMethodCall struct {
	ssa.CallCommon
}

func NewBuiltinDynamicMethodCall

func NewBuiltinDynamicMethodCall(common *ssa.CallCommon) *BuiltinDynamicMethodCall

func (*BuiltinDynamicMethodCall) Arg

func (b *BuiltinDynamicMethodCall) Arg(idx int) ssa.Value

func (*BuiltinDynamicMethodCall) ArgsLen

func (b *BuiltinDynamicMethodCall) ArgsLen() int

func (*BuiltinDynamicMethodCall) Match

func (b *BuiltinDynamicMethodCall) Match(namePattern string) bool

func (*BuiltinDynamicMethodCall) Method

func (b *BuiltinDynamicMethodCall) Method() *types.Func

func (*BuiltinDynamicMethodCall) Name

func (b *BuiltinDynamicMethodCall) Name() string

func (*BuiltinDynamicMethodCall) Recv

func (*BuiltinDynamicMethodCall) String

func (b *BuiltinDynamicMethodCall) String() string

type BuiltinStaticFunctionCall

type BuiltinStaticFunctionCall struct {
	ssa.CallCommon
}

func NewBuiltinStaticFunctionCall

func NewBuiltinStaticFunctionCall(common *ssa.CallCommon) *BuiltinStaticFunctionCall

func (*BuiltinStaticFunctionCall) Arg

func (b *BuiltinStaticFunctionCall) Arg(idx int) ssa.Value

func (*BuiltinStaticFunctionCall) ArgsLen

func (b *BuiltinStaticFunctionCall) ArgsLen() int

func (*BuiltinStaticFunctionCall) Func

func (*BuiltinStaticFunctionCall) Match

func (b *BuiltinStaticFunctionCall) Match(namePattern string) bool

func (*BuiltinStaticFunctionCall) Name

func (*BuiltinStaticFunctionCall) String

func (b *BuiltinStaticFunctionCall) String() string

type CallInfo

type CallInfo interface {
	Name() string
	Arg(idx int) ssa.Value
	ArgsLen() int
	Match(namePattern string) bool
	// contains filtered or unexported methods
}

func GetCallInfo

func GetCallInfo(common *ssa.CallCommon) CallInfo

type DynamicFunctionCall

type DynamicFunctionCall struct {
	ssa.CallCommon
}

func NewDynamicFunctionCall

func NewDynamicFunctionCall(common *ssa.CallCommon) *DynamicFunctionCall

func (*DynamicFunctionCall) Arg

func (d *DynamicFunctionCall) Arg(idx int) ssa.Value

func (*DynamicFunctionCall) ArgsLen

func (d *DynamicFunctionCall) ArgsLen() int

func (*DynamicFunctionCall) Match

func (d *DynamicFunctionCall) Match(namePattern string) bool

func (*DynamicFunctionCall) Name

func (d *DynamicFunctionCall) Name() string

func (*DynamicFunctionCall) String

func (d *DynamicFunctionCall) String() string

type DynamicMethodCall

type DynamicMethodCall struct {
	ssa.CallCommon
}

func NewDynamicMethodCall

func NewDynamicMethodCall(common *ssa.CallCommon) *DynamicMethodCall

func (*DynamicMethodCall) Arg

func (d *DynamicMethodCall) Arg(idx int) ssa.Value

func (*DynamicMethodCall) ArgsLen

func (d *DynamicMethodCall) ArgsLen() int

func (*DynamicMethodCall) Match

func (d *DynamicMethodCall) Match(namePattern string) bool

func (*DynamicMethodCall) Method

func (d *DynamicMethodCall) Method() *types.Func

func (*DynamicMethodCall) Name

func (d *DynamicMethodCall) Name() string

func (*DynamicMethodCall) Pkg

func (d *DynamicMethodCall) Pkg() *types.Package

func (*DynamicMethodCall) Recv

func (d *DynamicMethodCall) Recv() ssa.Value

func (*DynamicMethodCall) String

func (d *DynamicMethodCall) String() string

type Function

type Function interface {
	Func() *ssa.Function
	Arg(idx int) ssa.Value
	ArgsLen() int
}

type Method

type Method interface {
	Recv() ssa.Value
	Method() *types.Func
	Arg(idx int) ssa.Value
	ArgsLen() int
}

type Namer

type Namer interface {
	Name() string
}

type PackageFunction

type PackageFunction interface {
	Packager
	Function
}

type PackageMethod

type PackageMethod interface {
	Packager
	Method
}

type Packager

type Packager interface {
	Pkg() *types.Package
}

type Posx

type Posx struct {
	Func *ssa.Function
	Pos  []token.Pos
}

func NewPos

func NewPos(fn *ssa.Function, pos ...token.Pos) *Posx

func (*Posx) Add

func (p *Posx) Add(pos token.Pos) *Posx

func (*Posx) Compare

func (p *Posx) Compare(other *Posx) int

func (*Posx) Equal

func (p *Posx) Equal(other *Posx) bool

func (*Posx) LogValue

func (p *Posx) LogValue() slog.Value

func (*Posx) Package

func (m *Posx) Package() *types.Package

func (*Posx) PackagePath

func (p *Posx) PackagePath(abbreviate bool) string

func (*Posx) Position

func (m *Posx) Position() token.Position

func (*Posx) PositionString

func (p *Posx) PositionString() string

type StaticFunctionCall

type StaticFunctionCall struct {
	ssa.CallCommon
}

func NewStaticFunctionCall

func NewStaticFunctionCall(common *ssa.CallCommon) *StaticFunctionCall

func (*StaticFunctionCall) Arg

func (s *StaticFunctionCall) Arg(idx int) ssa.Value

func (*StaticFunctionCall) ArgsLen

func (s *StaticFunctionCall) ArgsLen() int

func (*StaticFunctionCall) Func

func (s *StaticFunctionCall) Func() *ssa.Function

func (*StaticFunctionCall) Match

func (s *StaticFunctionCall) Match(namePattern string) bool

func (*StaticFunctionCall) Name

func (s *StaticFunctionCall) Name() string

func (*StaticFunctionCall) Pkg

func (s *StaticFunctionCall) Pkg() *types.Package

func (*StaticFunctionCall) String

func (s *StaticFunctionCall) String() string

type StaticFunctionClosureCall

type StaticFunctionClosureCall struct {
	ssa.CallCommon
}

func NewStaticFunctionClosureCall

func NewStaticFunctionClosureCall(common *ssa.CallCommon) *StaticFunctionClosureCall

func (*StaticFunctionClosureCall) Arg

func (s *StaticFunctionClosureCall) Arg(idx int) ssa.Value

func (*StaticFunctionClosureCall) ArgsLen

func (s *StaticFunctionClosureCall) ArgsLen() int

func (*StaticFunctionClosureCall) Func

func (*StaticFunctionClosureCall) Match

func (s *StaticFunctionClosureCall) Match(namePattern string) bool

func (*StaticFunctionClosureCall) Name

func (*StaticFunctionClosureCall) Parent

func (s *StaticFunctionClosureCall) Parent() *ssa.Function

func (*StaticFunctionClosureCall) Pkg

func (*StaticFunctionClosureCall) String

func (s *StaticFunctionClosureCall) String() string

type StaticMethodCall

type StaticMethodCall struct {
	ssa.CallCommon
}

func NewStaticMethodCall

func NewStaticMethodCall(common *ssa.CallCommon) *StaticMethodCall

func (*StaticMethodCall) Arg

func (s *StaticMethodCall) Arg(idx int) ssa.Value

func (*StaticMethodCall) ArgsLen

func (s *StaticMethodCall) ArgsLen() int

func (*StaticMethodCall) Match

func (s *StaticMethodCall) Match(namePattern string) bool

func (*StaticMethodCall) Method

func (s *StaticMethodCall) Method() *types.Func

func (*StaticMethodCall) Name

func (s *StaticMethodCall) Name() string

func (*StaticMethodCall) Pkg

func (s *StaticMethodCall) Pkg() *types.Package

func (*StaticMethodCall) Recv

func (s *StaticMethodCall) Recv() ssa.Value

func (*StaticMethodCall) String

func (s *StaticMethodCall) String() string

type ToConstsFunc

type ToConstsFunc[T any] func(v ssa.Value, next func(v ssa.Value) ([]T, bool)) ([]T, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL