Documentation ¶
Index ¶
- func ForEachCapturedVariable[T versionedValue](scope ScopedVersionedTableIF[T], base ScopedVersionedTableIF[T], ...)
- func GetSSAScopeSaveCounter() uint64
- func GetSSAScopeTimeCost() time.Duration
- func RegisterLazyInstructionBuilder(builder func(id int64) (SSAValue, error))
- type FileDescriptor
- type GlobalIndexFetcher
- type GotoStmt
- type IfStmt
- type LabelStmt
- func (s *LabelStmt[T]) Break(from ScopedVersionedTableIF[T])
- func (s *LabelStmt[T]) Build() ScopedVersionedTableIF[T]
- func (s *LabelStmt[T]) Continue(from ScopedVersionedTableIF[T])
- func (s *LabelStmt[T]) FallThough(from ScopedVersionedTableIF[T])
- func (s *LabelStmt[T]) GetName() string
- func (s *LabelStmt[T]) SetName(name string)
- type LabelTarget
- type LinkNode
- type LoopStmt
- func (l *LoopStmt[T]) Break(from ScopedVersionedTableIF[T])
- func (l *LoopStmt[T]) Build(SpinHandler SpinHandle[T], mergeLatch MergeHandle[T], mergeEnd MergeHandle[T]) ScopedVersionedTableIF[T]
- func (l *LoopStmt[T]) Continue(from ScopedVersionedTableIF[T])
- func (l *LoopStmt[T]) FallThough(from ScopedVersionedTableIF[T])
- func (l *LoopStmt[T]) SetBody(f func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T])
- func (l *LoopStmt[T]) SetCondition(f func(ScopedVersionedTableIF[T]))
- func (l *LoopStmt[T]) SetFirst(f func(ScopedVersionedTableIF[T]))
- func (l *LoopStmt[T]) SetThird(f func(ScopedVersionedTableIF[T]))
- type MergeHandle
- type PackageFileLoader
- func (p *PackageFileLoader) AddIncludePath(s ...string)
- func (p *PackageFileLoader) AddPackagePath(path []string)
- func (p *PackageFileLoader) DirPath(wantPath string, once bool) (string, error)
- func (p *PackageFileLoader) FilePath(wantPath string, once bool) (string, error)
- func (p *PackageFileLoader) GetBasePath() string
- func (p *PackageFileLoader) GetCurrentPath() string
- func (p *PackageFileLoader) GetFilesysFileSystem() fi.FileSystem
- func (p *PackageFileLoader) GetIncludeFiles() []string
- func (p *PackageFileLoader) GetPackagePath() []string
- func (p *PackageFileLoader) LoadDirectoryPackage(packageName string, once bool) (chan FileDescriptor, error)
- func (p *PackageFileLoader) LoadFilePackage(packageName string, once bool) (string, *memedit.MemEditor, error)
- func (p *PackageFileLoader) SetCurrentPath(currentPath string)
- func (p *PackageFileLoader) SetIncludePaths(paths []string)
- type PackageLoaderOption
- type SSAValue
- type ScopedVersionedTable
- func (scope *ScopedVersionedTable[T]) AssignVariable(variable VersionedIF[T], value T)
- func (s *ScopedVersionedTable[T]) Compare(other ScopedVersionedTableIF[T]) bool
- func (base *ScopedVersionedTable[T]) CoverBy(scope ScopedVersionedTableIF[T])
- func (v *ScopedVersionedTable[T]) CreateShadowScope() ScopedVersionedTableIF[T]
- func (v *ScopedVersionedTable[T]) CreateSubScope() ScopedVersionedTableIF[T]
- func (v *ScopedVersionedTable[T]) CreateVariable(name string, isLocal bool) VersionedIF[T]
- func (ps *ScopedVersionedTable[T]) ForEachCapturedVariable(handler VariableHandler[T])
- func (s *ScopedVersionedTable[T]) GetForceCapture() bool
- func (v *ScopedVersionedTable[T]) GetParent() ScopedVersionedTableIF[T]
- func (s *ScopedVersionedTable[T]) GetScopeID() int64
- func (s *ScopedVersionedTable[T]) GetScopeLevel() int
- func (s *ScopedVersionedTable[T]) GetScopeName() string
- func (v *ScopedVersionedTable[T]) GetThis() ScopedVersionedTableIF[T]
- func (scope *ScopedVersionedTable[T]) GetVariableFromValue(value T) VersionedIF[T]
- func (v *ScopedVersionedTable[T]) IsRoot() bool
- func (s *ScopedVersionedTable[T]) IsSameOrSubScope(other ScopedVersionedTableIF[T]) bool
- func (base *ScopedVersionedTable[T]) Merge(hasSelf bool, merge MergeHandle[T], subScopes ...ScopedVersionedTableIF[T])
- func (v *ScopedVersionedTable[T]) ReadValue(name string) (t T)
- func (scope *ScopedVersionedTable[T]) ReadVariable(name string) VersionedIF[T]
- func (s *ScopedVersionedTable[T]) SetCallback(f func(VersionedIF[T]))
- func (scope *ScopedVersionedTable[T]) SetCapturedVariable(name string, ver VersionedIF[T])
- func (s *ScopedVersionedTable[T]) SetForceCapture()
- func (v *ScopedVersionedTable[T]) SetParent(parent ScopedVersionedTableIF[T])
- func (s *ScopedVersionedTable[T]) SetParentId(i int64)
- func (s *ScopedVersionedTable[T]) SetScopeID(i int64)
- func (s *ScopedVersionedTable[T]) SetScopeLevel(i int)
- func (s *ScopedVersionedTable[T]) SetScopeName(name string)
- func (s *ScopedVersionedTable[T]) SetSpin(create func(string) T)
- func (s *ScopedVersionedTable[T]) SetSpinRaw(b bool)
- func (v *ScopedVersionedTable[T]) SetThis(scope ScopedVersionedTableIF[T])
- func (condition *ScopedVersionedTable[T]) Spin(header, latch ScopedVersionedTableIF[T], handler SpinHandle[T])
- type ScopedVersionedTableIF
- type SpinHandle
- type SwitchStmt
- func (s *SwitchStmt[T]) Break(from ScopedVersionedTableIF[T])
- func (s *SwitchStmt[T]) Build(merge func(string, []T) T) ScopedVersionedTableIF[T]
- func (s *SwitchStmt[T]) BuildBody(body func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T], ...)
- func (s *SwitchStmt[T]) BuildCondition(body func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T]
- func (s *SwitchStmt[T]) BuildConditionWithoutExprsion()
- func (s *SwitchStmt[T]) Continue(from ScopedVersionedTableIF[T])
- func (s *SwitchStmt[T]) FallThough(from ScopedVersionedTableIF[T])
- type TryStmt
- func (t *TryStmt[T]) AddCache(build func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T])
- func (t *TryStmt[T]) Build() ScopedVersionedTableIF[T]
- func (t *TryStmt[T]) CreateFinally() ScopedVersionedTableIF[T]
- func (t *TryStmt[T]) SetError(name string)
- func (t *TryStmt[T]) SetFinal(build func() ScopedVersionedTableIF[T])
- func (t *TryStmt[T]) SetTryBody(body func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T])
- type VariableHandler
- type Versioned
- func (v *Versioned[T]) Assign(val T) error
- func (v *Versioned[T]) CanCaptureInScope(base ScopedVersionedTableIF[T]) bool
- func (v *Versioned[T]) CaptureInScope(base ScopedVersionedTableIF[T]) (VersionedIF[T], bool)
- func (v *Versioned[T]) GetCaptured() VersionedIF[T]
- func (v *Versioned[T]) GetGlobalIndex() int
- func (v *Versioned[T]) GetId() int64
- func (v *Versioned[T]) GetLocal() bool
- func (v *Versioned[T]) GetName() string
- func (v *Versioned[T]) GetRootVersion() VersionedIF[T]
- func (v *Versioned[T]) GetScope() ScopedVersionedTableIF[T]
- func (v *Versioned[T]) GetValue() (ret T)
- func (v *Versioned[T]) GetVersion() int64
- func (v *Versioned[T]) IsNil() bool
- func (v *Versioned[T]) IsRoot() bool
- func (v *Versioned[T]) MarshalJSON() ([]byte, error)
- func (v *Versioned[T]) Replace(val, to T)
- func (v *Versioned[T]) SetCaptured(capture VersionedIF[T])
- func (v *Versioned[T]) SetScope(s ScopedVersionedTableIF[T])
- func (v *Versioned[T]) SetVersion(version int64)
- func (v *Versioned[T]) String() string
- func (v *Versioned[T]) UnmarshalJSON(raw []byte) error
- type VersionedBuilder
- type VersionedIF
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForEachCapturedVariable ¶
func ForEachCapturedVariable[T versionedValue]( scope ScopedVersionedTableIF[T], base ScopedVersionedTableIF[T], handler VariableHandler[T], )
ForEachCapturedVariable call the handler for each captured by base scope Variable
func GetSSAScopeSaveCounter ¶
func GetSSAScopeSaveCounter() uint64
func GetSSAScopeTimeCost ¶
func RegisterLazyInstructionBuilder ¶ added in v1.3.3
Types ¶
type FileDescriptor ¶ added in v1.3.3
type GotoStmt ¶
type GotoStmt[T versionedValue] struct {
// contains filtered or unexported fields
}
func NewGotoStmt ¶
func NewGotoStmt[T versionedValue](enter ScopedVersionedTableIF[T], _goto ScopedVersionedTableIF[T]) *GotoStmt[T]
func (*GotoStmt[T]) Break ¶
func (s *GotoStmt[T]) Break(from ScopedVersionedTableIF[T])
func (*GotoStmt[T]) Build ¶
func (s *GotoStmt[T]) Build(merge func(string, []T) T) ScopedVersionedTableIF[T]
func (*GotoStmt[T]) Continue ¶
func (s *GotoStmt[T]) Continue(from ScopedVersionedTableIF[T])
func (*GotoStmt[T]) FallThough ¶
func (s *GotoStmt[T]) FallThough(from ScopedVersionedTableIF[T])
type IfStmt ¶
type IfStmt[T versionedValue] struct { BodyScopes []ScopedVersionedTableIF[T] // contains filtered or unexported fields }
IfStmt represents an if statement.
func NewIfStmt ¶
func NewIfStmt[T versionedValue](global ScopedVersionedTableIF[T]) *IfStmt[T]
NewIfStmt creates a new IfStmt with the given global scope.
IfStmt will handle if-stmt scope. API: * BuildItem(condition fun(scope), body func(scope)): build if item using the provided Condition and Body functions. * BuildElse(elseBody func(scope)): set the else function for the IfStmt. * BuildFinish(mergeHandler func(name string, t []T) T): build the IfStmt finish, using the provided mergeHandler function create Phi. IfStmt will build this scope when this method call
func (*IfStmt[T]) BuildElse ¶
func (i *IfStmt[T]) BuildElse(elseBody func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T])
SetElse sets the else function for the IfStmt.
func (*IfStmt[T]) BuildFinish ¶
func (i *IfStmt[T]) BuildFinish( mergeHandler MergeHandle[T], ) ScopedVersionedTableIF[T]
Build builds the IfStmt using the provided mergeHandler function.
func (*IfStmt[T]) BuildItem ¶
func (i *IfStmt[T]) BuildItem(Condition func(ScopedVersionedTableIF[T]), Body func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T])
BuildItem build the if item using the provided Condition and Body functions.
type LabelStmt ¶
type LabelStmt[T versionedValue] struct {
// contains filtered or unexported fields
}
func NewLabelStmt ¶
func NewLabelStmt[T versionedValue](enter ScopedVersionedTableIF[T]) *LabelStmt[T]
func (*LabelStmt[T]) Break ¶
func (s *LabelStmt[T]) Break(from ScopedVersionedTableIF[T])
func (*LabelStmt[T]) Build ¶
func (s *LabelStmt[T]) Build() ScopedVersionedTableIF[T]
func (*LabelStmt[T]) Continue ¶
func (s *LabelStmt[T]) Continue(from ScopedVersionedTableIF[T])
func (*LabelStmt[T]) FallThough ¶
func (s *LabelStmt[T]) FallThough(from ScopedVersionedTableIF[T])
type LabelTarget ¶
type LabelTarget[T versionedValue] interface { Break(from ScopedVersionedTableIF[T]) Continue(from ScopedVersionedTableIF[T]) FallThough(from ScopedVersionedTableIF[T]) }
type LinkNode ¶
type LinkNode[T versionedValue] struct {
// contains filtered or unexported fields
}
func (*LinkNode[T]) Append ¶
func (n *LinkNode[T]) Append(val VersionedIF[T])
func (*LinkNode[T]) Last ¶
func (n *LinkNode[T]) Last() VersionedIF[T]
type LoopStmt ¶
type LoopStmt[T versionedValue] struct { MergeToEnd []ScopedVersionedTableIF[T] // break, merge phi in exit MergeToLatch []ScopedVersionedTableIF[T] // continue, merge phi in latch ThirdBuilder func(ScopedVersionedTableIF[T]) // third // contains filtered or unexported fields }
LoopStmt represents a loop statement.
func NewLoopStmt ¶
func NewLoopStmt[T versionedValue](global ScopedVersionedTableIF[T], NewPhi func(string) T) *LoopStmt[T]
NewLoopStmt creates a new LoopStmt with the given global scope.
func (*LoopStmt[T]) Break ¶
func (l *LoopStmt[T]) Break(from ScopedVersionedTableIF[T])
func (*LoopStmt[T]) Build ¶
func (l *LoopStmt[T]) Build( SpinHandler SpinHandle[T], mergeLatch MergeHandle[T], mergeEnd MergeHandle[T], ) ScopedVersionedTableIF[T]
Build builds the LoopStmt using the provided NewPhi and SpinHandler functions.
func (*LoopStmt[T]) Continue ¶
func (l *LoopStmt[T]) Continue(from ScopedVersionedTableIF[T])
func (*LoopStmt[T]) FallThough ¶
func (l *LoopStmt[T]) FallThough(from ScopedVersionedTableIF[T])
func (*LoopStmt[T]) SetBody ¶
func (l *LoopStmt[T]) SetBody(f func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T])
SetBody sets the body function for the LoopStmt.
func (*LoopStmt[T]) SetCondition ¶
func (l *LoopStmt[T]) SetCondition(f func(ScopedVersionedTableIF[T]))
SetCondition sets the condition function for the LoopStmt.
func (*LoopStmt[T]) SetFirst ¶
func (l *LoopStmt[T]) SetFirst(f func(ScopedVersionedTableIF[T]))
SetFirst sets the first function for the LoopStmt.
func (*LoopStmt[T]) SetThird ¶
func (l *LoopStmt[T]) SetThird(f func(ScopedVersionedTableIF[T]))
SetThird sets the third function for the LoopStmt.
type MergeHandle ¶
type MergeHandle[T comparable] func(string, []T) T
MergeHandle handler Merge Value generate Phi
type PackageFileLoader ¶
type PackageFileLoader struct {
// contains filtered or unexported fields
}
func NewPackageLoader ¶ added in v1.3.3
func NewPackageLoader(opts ...PackageLoaderOption) *PackageFileLoader
func (*PackageFileLoader) AddIncludePath ¶
func (p *PackageFileLoader) AddIncludePath(s ...string)
func (*PackageFileLoader) AddPackagePath ¶
func (p *PackageFileLoader) AddPackagePath(path []string)
func (*PackageFileLoader) DirPath ¶
func (p *PackageFileLoader) DirPath(wantPath string, once bool) (string, error)
func (*PackageFileLoader) FilePath ¶
func (p *PackageFileLoader) FilePath(wantPath string, once bool) (string, error)
func (*PackageFileLoader) GetBasePath ¶
func (p *PackageFileLoader) GetBasePath() string
func (*PackageFileLoader) GetCurrentPath ¶
func (p *PackageFileLoader) GetCurrentPath() string
func (*PackageFileLoader) GetFilesysFileSystem ¶
func (p *PackageFileLoader) GetFilesysFileSystem() fi.FileSystem
func (*PackageFileLoader) GetIncludeFiles ¶
func (p *PackageFileLoader) GetIncludeFiles() []string
GetIncludeFiles get include path
func (*PackageFileLoader) GetPackagePath ¶
func (p *PackageFileLoader) GetPackagePath() []string
func (*PackageFileLoader) LoadDirectoryPackage ¶
func (p *PackageFileLoader) LoadDirectoryPackage(packageName string, once bool) (chan FileDescriptor, error)
func (*PackageFileLoader) LoadFilePackage ¶
func (*PackageFileLoader) SetCurrentPath ¶
func (p *PackageFileLoader) SetCurrentPath(currentPath string)
func (*PackageFileLoader) SetIncludePaths ¶
func (p *PackageFileLoader) SetIncludePaths(paths []string)
type PackageLoaderOption ¶ added in v1.3.3
type PackageLoaderOption func(*PackageFileLoader)
func WithBasePath ¶
func WithBasePath(path string) PackageLoaderOption
func WithCurrentPath ¶ added in v1.3.3
func WithCurrentPath(path string) PackageLoaderOption
func WithFileSystem ¶ added in v1.3.3
func WithFileSystem(fs fi.FileSystem) PackageLoaderOption
func WithIncludePath ¶ added in v1.3.3
func WithIncludePath(paths ...string) PackageLoaderOption
type SSAValue ¶
func NewLazyInstruction ¶ added in v1.3.3
type ScopedVersionedTable ¶
type ScopedVersionedTable[T versionedValue] struct { ProgramName string ForceCapture bool ScopeName string ScopeId int64 // contains filtered or unexported fields }
func NewRootVersionedTable ¶
func NewRootVersionedTable[T versionedValue]( programName string, newVersioned VersionedBuilder[T], fetcher ...func() int, ) *ScopedVersionedTable[T]
func NewScope ¶
func NewScope[T versionedValue]( programName string, fetcher func() int, newVersioned VersionedBuilder[T], parent ScopedVersionedTableIF[T], ) *ScopedVersionedTable[T]
func (*ScopedVersionedTable[T]) AssignVariable ¶
func (scope *ScopedVersionedTable[T]) AssignVariable(variable VersionedIF[T], value T)
---------------- Assign
func (*ScopedVersionedTable[T]) Compare ¶
func (s *ScopedVersionedTable[T]) Compare(other ScopedVersionedTableIF[T]) bool
func (*ScopedVersionedTable[T]) CoverBy ¶
func (base *ScopedVersionedTable[T]) CoverBy(scope ScopedVersionedTableIF[T])
func (*ScopedVersionedTable[T]) CreateShadowScope ¶
func (v *ScopedVersionedTable[T]) CreateShadowScope() ScopedVersionedTableIF[T]
func (*ScopedVersionedTable[T]) CreateSubScope ¶
func (v *ScopedVersionedTable[T]) CreateSubScope() ScopedVersionedTableIF[T]
func (*ScopedVersionedTable[T]) CreateVariable ¶
func (v *ScopedVersionedTable[T]) CreateVariable(name string, isLocal bool) VersionedIF[T]
func (*ScopedVersionedTable[T]) ForEachCapturedVariable ¶
func (ps *ScopedVersionedTable[T]) ForEachCapturedVariable(handler VariableHandler[T])
func (*ScopedVersionedTable[T]) GetForceCapture ¶
func (s *ScopedVersionedTable[T]) GetForceCapture() bool
func (*ScopedVersionedTable[T]) GetParent ¶
func (v *ScopedVersionedTable[T]) GetParent() ScopedVersionedTableIF[T]
func (*ScopedVersionedTable[T]) GetScopeID ¶
func (s *ScopedVersionedTable[T]) GetScopeID() int64
func (*ScopedVersionedTable[T]) GetScopeLevel ¶
func (s *ScopedVersionedTable[T]) GetScopeLevel() int
use for up lever
func (*ScopedVersionedTable[T]) GetScopeName ¶
func (s *ScopedVersionedTable[T]) GetScopeName() string
func (*ScopedVersionedTable[T]) GetThis ¶
func (v *ScopedVersionedTable[T]) GetThis() ScopedVersionedTableIF[T]
func (*ScopedVersionedTable[T]) GetVariableFromValue ¶
func (scope *ScopedVersionedTable[T]) GetVariableFromValue(value T) VersionedIF[T]
func (*ScopedVersionedTable[T]) IsRoot ¶
func (v *ScopedVersionedTable[T]) IsRoot() bool
func (*ScopedVersionedTable[T]) IsSameOrSubScope ¶
func (s *ScopedVersionedTable[T]) IsSameOrSubScope(other ScopedVersionedTableIF[T]) bool
IsSubScope check if the scope is sub scope of the other
func (*ScopedVersionedTable[T]) Merge ¶
func (base *ScopedVersionedTable[T]) Merge( hasSelf bool, merge MergeHandle[T], subScopes ...ScopedVersionedTableIF[T], )
Merge merge the sub-scope to current scope, if hasSelf is true: the current scope will be merged to the result
func (*ScopedVersionedTable[T]) ReadValue ¶
func (v *ScopedVersionedTable[T]) ReadValue(name string) (t T)
func (*ScopedVersionedTable[T]) ReadVariable ¶
func (scope *ScopedVersionedTable[T]) ReadVariable(name string) VersionedIF[T]
func (*ScopedVersionedTable[T]) SetCallback ¶
func (s *ScopedVersionedTable[T]) SetCallback(f func(VersionedIF[T]))
func (*ScopedVersionedTable[T]) SetCapturedVariable ¶
func (scope *ScopedVersionedTable[T]) SetCapturedVariable(name string, ver VersionedIF[T])
func (*ScopedVersionedTable[T]) SetForceCapture ¶
func (s *ScopedVersionedTable[T]) SetForceCapture()
func (*ScopedVersionedTable[T]) SetParent ¶ added in v1.3.3
func (v *ScopedVersionedTable[T]) SetParent(parent ScopedVersionedTableIF[T])
func (*ScopedVersionedTable[T]) SetParentId ¶ added in v1.3.3
func (s *ScopedVersionedTable[T]) SetParentId(i int64)
func (*ScopedVersionedTable[T]) SetScopeID ¶
func (s *ScopedVersionedTable[T]) SetScopeID(i int64)
func (*ScopedVersionedTable[T]) SetScopeLevel ¶ added in v1.3.3
func (s *ScopedVersionedTable[T]) SetScopeLevel(i int)
func (*ScopedVersionedTable[T]) SetScopeName ¶
func (s *ScopedVersionedTable[T]) SetScopeName(name string)
func (*ScopedVersionedTable[T]) SetSpin ¶
func (s *ScopedVersionedTable[T]) SetSpin(create func(string) T)
func (*ScopedVersionedTable[T]) SetSpinRaw ¶ added in v1.3.3
func (s *ScopedVersionedTable[T]) SetSpinRaw(b bool)
func (*ScopedVersionedTable[T]) SetThis ¶
func (v *ScopedVersionedTable[T]) SetThis(scope ScopedVersionedTableIF[T])
func (*ScopedVersionedTable[T]) Spin ¶
func (condition *ScopedVersionedTable[T]) Spin( header, latch ScopedVersionedTableIF[T], handler SpinHandle[T], )
this handler merge [origin, last] to phi
type ScopedVersionedTableIF ¶
type ScopedVersionedTableIF[T versionedValue] interface { // Read Variable by name ReadVariable(name string) VersionedIF[T] // read value by name ReadValue(name string) T // create variable, if isLocal is true, the variable is local CreateVariable(name string, isLocal bool) VersionedIF[T] // assign a value to the variable AssignVariable(VersionedIF[T], T) GetVariableFromValue(T) VersionedIF[T] // this scope SetThis(ScopedVersionedTableIF[T]) GetThis() ScopedVersionedTableIF[T] SetForceCapture() GetForceCapture() bool // create sub scope CreateSubScope() ScopedVersionedTableIF[T] CreateShadowScope() ScopedVersionedTableIF[T] // get scope level, each scope has a level, the root scope is 0, the sub scope is {parent-scope.level + 1} GetScopeLevel() int GetParent() ScopedVersionedTableIF[T] SetParent(ScopedVersionedTableIF[T]) IsSameOrSubScope(ScopedVersionedTableIF[T]) bool Compare(ScopedVersionedTableIF[T]) bool // use in ssautil, handle inner member ForEachCapturedVariable(VariableHandler[T]) SetCapturedVariable(string, VersionedIF[T]) // use in phi CoverBy(ScopedVersionedTableIF[T]) Merge(bool, MergeHandle[T], ...ScopedVersionedTableIF[T]) Spin(ScopedVersionedTableIF[T], ScopedVersionedTableIF[T], SpinHandle[T]) SetSpin(func(string) T) // db // SaveToDatabase() error // SetCallback() error // GetPersistentId() int64 // SetPersistentId(i int64) // SetPersistentNode(*ssadb.IrScopeNode) GetScopeName() string SetScopeName(string) }
ScopedVersionedTableIF is the interface for scope versioned table
func BuildSyntaxBlock ¶
func BuildSyntaxBlock[T versionedValue]( global ScopedVersionedTableIF[T], buildBody func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T], ) ScopedVersionedTableIF[T]
BuildSyntaxBlock builds a syntax block using the provided scope and buildBody function.
if this scope finish this program
* BuildBody should return true
* this function will return true
type SpinHandle ¶
type SpinHandle[T comparable] func(string, T, T, T) map[string]T
SpinHandle for Loop Spin Phi
type SwitchStmt ¶
type SwitchStmt[T versionedValue] struct { AutoBreak bool // contains filtered or unexported fields }
func NewSwitchStmt ¶
func NewSwitchStmt[T versionedValue](global ScopedVersionedTableIF[T], AutoBreak bool) *SwitchStmt[T]
func (*SwitchStmt[T]) Break ¶
func (s *SwitchStmt[T]) Break(from ScopedVersionedTableIF[T])
func (*SwitchStmt[T]) Build ¶
func (s *SwitchStmt[T]) Build(merge func(string, []T) T) ScopedVersionedTableIF[T]
func (*SwitchStmt[T]) BuildBody ¶
func (s *SwitchStmt[T]) BuildBody( body func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T], merge func(string, []T) T, )
func (*SwitchStmt[T]) BuildCondition ¶
func (s *SwitchStmt[T]) BuildCondition( body func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T], ) ScopedVersionedTableIF[T]
func (*SwitchStmt[T]) BuildConditionWithoutExprsion ¶
func (s *SwitchStmt[T]) BuildConditionWithoutExprsion()
func (*SwitchStmt[T]) Continue ¶
func (s *SwitchStmt[T]) Continue(from ScopedVersionedTableIF[T])
func (*SwitchStmt[T]) FallThough ¶
func (s *SwitchStmt[T]) FallThough(from ScopedVersionedTableIF[T])
type TryStmt ¶
type TryStmt[T versionedValue] struct { ErrorName string // contains filtered or unexported fields }
func NewTryStmt ¶
func NewTryStmt[T versionedValue]( global ScopedVersionedTableIF[T], mergeHandler MergeHandle[T], ) *TryStmt[T]
func (*TryStmt[T]) AddCache ¶
func (t *TryStmt[T]) AddCache(build func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T])
func (*TryStmt[T]) Build ¶
func (t *TryStmt[T]) Build() ScopedVersionedTableIF[T]
func (*TryStmt[T]) CreateFinally ¶
func (t *TryStmt[T]) CreateFinally() ScopedVersionedTableIF[T]
func (*TryStmt[T]) SetFinal ¶
func (t *TryStmt[T]) SetFinal(build func() ScopedVersionedTableIF[T])
func (*TryStmt[T]) SetTryBody ¶
func (t *TryStmt[T]) SetTryBody(body func(ScopedVersionedTableIF[T]) ScopedVersionedTableIF[T])
type VariableHandler ¶
type VariableHandler[T versionedValue] func(string, VersionedIF[T])
capture variable
type Versioned ¶
type Versioned[T versionedValue] struct { Value T // contains filtered or unexported fields }
func (*Versioned[T]) CanCaptureInScope ¶
func (v *Versioned[T]) CanCaptureInScope(base ScopedVersionedTableIF[T]) bool
func (*Versioned[T]) CaptureInScope ¶
func (v *Versioned[T]) CaptureInScope(base ScopedVersionedTableIF[T]) (VersionedIF[T], bool)
func (*Versioned[T]) GetCaptured ¶
func (v *Versioned[T]) GetCaptured() VersionedIF[T]
func (*Versioned[T]) GetGlobalIndex ¶
func (*Versioned[T]) GetRootVersion ¶
func (v *Versioned[T]) GetRootVersion() VersionedIF[T]
func (*Versioned[T]) GetScope ¶
func (v *Versioned[T]) GetScope() ScopedVersionedTableIF[T]
func (*Versioned[T]) GetVersion ¶
func (*Versioned[T]) MarshalJSON ¶ added in v1.3.3
func (*Versioned[T]) SetCaptured ¶
func (v *Versioned[T]) SetCaptured(capture VersionedIF[T])
func (*Versioned[T]) SetScope ¶ added in v1.3.3
func (v *Versioned[T]) SetScope(s ScopedVersionedTableIF[T])
func (*Versioned[T]) SetVersion ¶
func (*Versioned[T]) UnmarshalJSON ¶ added in v1.3.3
type VersionedBuilder ¶
type VersionedBuilder[T versionedValue] func(globalIndex int, name string, local bool, scope ScopedVersionedTableIF[T]) VersionedIF[T]
type VersionedIF ¶
type VersionedIF[T versionedValue] interface { // value // IsNil return true if the variable is nil IsNil() bool GetValue() T // Replace Replace(T, T) // Assign assign a value to the variable Assign(T) error // show, string and name String() string GetName() string // version SetVersion(int64) GetVersion() int64 // local GetLocal() bool // capture CaptureInScope(ScopedVersionedTableIF[T]) (VersionedIF[T], bool) CanCaptureInScope(ScopedVersionedTableIF[T]) bool // capture variable SetCaptured(VersionedIF[T]) // this capture will set self, when variable create. GetCaptured() VersionedIF[T] // scope GetScope() ScopedVersionedTableIF[T] SetScope(ScopedVersionedTableIF[T]) // version and root GetGlobalIndex() int // global id GetRootVersion() VersionedIF[T] IsRoot() bool GetId() int64 MarshalJSON() ([]byte, error) UnmarshalJSON([]byte) error }
VersionedIF is an interface for versioned variable, scope will use this interface
func NewVersioned ¶
func NewVersioned[T versionedValue](globalIndex int, name string, local bool, scope ScopedVersionedTableIF[T]) VersionedIF[T]