ssaapi

package
v1.2.8-sp5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Number        = newType(ssa.BasicTypes[ssa.Number])
	String        = newType(ssa.BasicTypes[ssa.String])
	Bytes         = newType(ssa.BasicTypes[ssa.Bytes])
	Boolean       = newType(ssa.BasicTypes[ssa.Boolean])
	UndefinedType = newType(ssa.BasicTypes[ssa.UndefinedType])
	Null          = newType(ssa.BasicTypes[ssa.Null])
	Any           = newType(ssa.BasicTypes[ssa.Any])
	ErrorType     = newType(ssa.BasicTypes[ssa.ErrorType])
)
View Source
var Exports = map[string]any{
	"Parse": Parse,

	"withLanguage":    WithLanguage,
	"withExternLib":   WithExternLib,
	"withExternValue": WithExternValue,

	"Javascript": JS,
	"Yak":        Yak,
}

Functions

func TypeCompare added in v1.2.9

func TypeCompare(t1, t2 *Type) bool

func ValueCompare added in v1.2.9

func ValueCompare(v1, v2 *Value) bool

Types

type Language

type Language string
const (
	JS  Language = "js"
	Yak Language = "yak"
)

type Option

type Option func(*config)

func WithExternLib

func WithExternLib(name string, table map[string]any) Option

func WithExternMethod added in v1.2.9

func WithExternMethod(b ssa.MethodBuilder) Option

func WithExternValue

func WithExternValue(table map[string]any) Option

func WithLanguage

func WithLanguage(language Language) Option

type Program

type Program struct {
	*ssa.Program
}

func NewProgram

func NewProgram(prog *ssa.Program) *Program

func Parse

func Parse(code string, opts ...Option) *Program

func (*Program) IsNil added in v1.2.9

func (p *Program) IsNil() bool

func (*Program) Ref

func (p *Program) Ref(name string) Values

type Type added in v1.2.9

type Type struct {
	// contains filtered or unexported fields
}

func FuncOf added in v1.2.9

func FuncOf(name string, args, ret []*Type, isVariadic bool) *Type

func MapOf added in v1.2.9

func MapOf(key, value *Type) *Type

func SliceOf added in v1.2.9

func SliceOf(t *Type) *Type

func (*Type) Compare added in v1.2.9

func (t *Type) Compare(t2 *Type) bool

func (*Type) String added in v1.2.9

func (t *Type) String() string

type Value

type Value struct {
	// contains filtered or unexported fields
}

func NewValue

func NewValue(n ssa.InstructionNode) *Value

func (*Value) Compare added in v1.2.9

func (v *Value) Compare(other *Value) bool

func (*Value) FixUpdateValue added in v1.2.9

func (v *Value) FixUpdateValue() Values

func (*Value) GetBlock

func (v *Value) GetBlock() *Value

func (*Value) GetConst added in v1.2.9

func (v *Value) GetConst() *ssa.Const

func (*Value) GetConstValue added in v1.2.9

func (v *Value) GetConstValue() any

for const instruction

func (*Value) GetFunction

func (v *Value) GetFunction() *Value

func (*Value) GetOperand

func (i *Value) GetOperand(index int) *Value

func (*Value) GetOperands

func (i *Value) GetOperands() Values

func (*Value) GetParameter

func (v *Value) GetParameter(i int) *Value

func (*Value) GetParameters added in v1.2.9

func (v *Value) GetParameters() Values

func (*Value) GetPosition added in v1.2.9

func (v *Value) GetPosition() *ssa.Position

func (*Value) GetReachable

func (v *Value) GetReachable() *Value

func (*Value) GetReturn

func (v *Value) GetReturn() Values

func (*Value) GetType added in v1.2.9

func (v *Value) GetType() *Type

func (*Value) GetUser

func (i *Value) GetUser(index int) *Value

func (*Value) GetUsers

func (i *Value) GetUsers() Values

func (*Value) HasOperands

func (i *Value) HasOperands() bool

func (*Value) HasUsers

func (i *Value) HasUsers() bool

func (*Value) InMainFunction

func (v *Value) InMainFunction() bool

func (*Value) IsAssert

func (v *Value) IsAssert() bool

func (*Value) IsBasicBlock

func (v *Value) IsBasicBlock() bool

func (*Value) IsBinOp

func (v *Value) IsBinOp() bool

func (*Value) IsCall

func (v *Value) IsCall() bool

func (*Value) IsConstInst

func (v *Value) IsConstInst() bool

func (*Value) IsErrorHandler

func (v *Value) IsErrorHandler() bool

func (*Value) IsField

func (v *Value) IsField() bool

func (*Value) IsFunction

func (v *Value) IsFunction() bool

func (*Value) IsIf

func (v *Value) IsIf() bool

func (*Value) IsJump

func (v *Value) IsJump() bool

func (*Value) IsLoop

func (v *Value) IsLoop() bool

func (*Value) IsMake

func (v *Value) IsMake() bool

func (*Value) IsNext

func (v *Value) IsNext() bool

func (*Value) IsPanic

func (v *Value) IsPanic() bool

func (*Value) IsPhi

func (v *Value) IsPhi() bool

func (*Value) IsReachable

func (v *Value) IsReachable() int

if condition is true : 1 reach if condition is false : -1 unreachable if condition need calc: 0 unknown

func (*Value) IsRecover

func (v *Value) IsRecover() bool

func (*Value) IsReturn

func (v *Value) IsReturn() bool

func (*Value) IsSwitch

func (v *Value) IsSwitch() bool

func (*Value) IsTypeCast

func (v *Value) IsTypeCast() bool

func (*Value) IsTypeValue

func (v *Value) IsTypeValue() bool

func (*Value) IsUnOp

func (v *Value) IsUnOp() bool

func (*Value) IsUndefined

func (v *Value) IsUndefined() bool

func (*Value) IsUpdate

func (v *Value) IsUpdate() bool

func (*Value) NewError added in v1.2.9

func (v *Value) NewError(tag, msg string)

func (*Value) NewWarn added in v1.2.9

func (v *Value) NewWarn(tag, msg string)

func (*Value) Show

func (i *Value) Show()

func (*Value) ShowUseDefChain

func (v *Value) ShowUseDefChain()

func (*Value) ShowWithSource

func (i *Value) ShowWithSource()

func (*Value) String

func (v *Value) String() string

func (*Value) StringWithSource

func (i *Value) StringWithSource() string

type Values

type Values []*Value

func (Values) Filter added in v1.2.9

func (v Values) Filter(f func(*Value) bool) Values

func (Values) ForEach

func (v Values) ForEach(f func(*Value))

func (Values) Get

func (v Values) Get(i int) *Value

func (Values) GetUsers added in v1.2.9

func (v Values) GetUsers() Values

func (Values) Ref

func (value Values) Ref(name string) Values

func (Values) Show

func (v Values) Show()

func (Values) ShowWithSource

func (v Values) ShowWithSource()

func (Values) StringEx

func (v Values) StringEx(flag int) string

Jump to

Keyboard shortcuts

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