internal

package
v0.0.0-...-8d34ba3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 141 Imported by: 0

Documentation

Overview

Code generated by cmd/genstdlib/main.go; DO NOT EDIT.

Code generated by cmd/genstdlib/main.go; DO NOT EDIT.

Code generated by cmd/genstdlib/main.go; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallPackageFunction

func CallPackageFunction(pkg *Package, functionName string, args []any, optionalVM *VM) ([]any, error)

func LoadGoMod

func LoadGoMod(filename string) (*modfile.File, error)

func LoadPackage

func LoadPackage(dir string, optionalConfig *packages.Config) (*packages.Package, error)

func NewPackageIdent

func NewPackageIdent(path, name string) pkgIdent

NewPackageIdent allow plugins to add bindings.

func RegisterPackage

func RegisterPackage(pkgPath string, symbols map[string]reflect.Value)

Types

type ASTBuilder

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

func (*ASTBuilder) Err

func (b *ASTBuilder) Err() error

func (*ASTBuilder) Visit

func (b *ASTBuilder) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface

type ArrayType

type ArrayType struct {
	Lbrack token.Pos // position of "["
	Len    Expr
	Elt    Expr
}

func (ArrayType) Eval

func (a ArrayType) Eval(vm *VM)

Eval creates and pushes an instance of the array or slice type onto the operand stack.

func (ArrayType) Flow

func (a ArrayType) Flow(g *graphBuilder) (head Step)

func (ArrayType) LiteralCompose

func (a ArrayType) LiteralCompose(vm *VM, composite reflect.Value, values []reflect.Value) reflect.Value

composite is (a reflect on) a Go array or slice

func (ArrayType) Make

func (a ArrayType) Make(vm *VM, size int, constructorArgs []reflect.Value) reflect.Value

func (ArrayType) Pos

func (a ArrayType) Pos() token.Pos

func (ArrayType) String

func (a ArrayType) String() string

type AssignStmt

type AssignStmt struct {
	TokPos token.Pos   // position of Tok
	Tok    token.Token // assignment token, DEFINE
	Lhs    []Expr
	Rhs    []Expr
	// contains filtered or unexported fields
}

func (AssignStmt) Eval

func (a AssignStmt) Eval(vm *VM)

func (AssignStmt) Flow

func (a AssignStmt) Flow(g *graphBuilder) (head Step)

pairwise flow

func (AssignStmt) Pos

func (a AssignStmt) Pos() token.Pos

func (AssignStmt) String

func (a AssignStmt) String() string

type BasicLit

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

func (BasicLit) Eval

func (b BasicLit) Eval(vm *VM)

func (BasicLit) Flow

func (b BasicLit) Flow(g *graphBuilder) (head Step)

func (BasicLit) Pos

func (b BasicLit) Pos() token.Pos

func (BasicLit) String

func (b BasicLit) String() string

type BinaryExpr

type BinaryExpr struct {
	OpPos token.Pos   // position of Op
	Op    token.Token // operator
	X     Expr        // left
	Y     Expr        // right
}

func (BinaryExpr) Eval

func (b BinaryExpr) Eval(vm *VM)

func (BinaryExpr) Flow

func (b BinaryExpr) Flow(g *graphBuilder) (head Step)

func (BinaryExpr) Pos

func (b BinaryExpr) Pos() token.Pos

func (BinaryExpr) String

func (b BinaryExpr) String() string

type BinaryExpr2

type BinaryExpr2 struct {
	OpPos token.Pos
	Op    token.Token
	X     Expr // left
	Y     Expr // right
	// contains filtered or unexported fields
}

func (BinaryExpr2) Eval

func (b BinaryExpr2) Eval(vm *VM)

func (BinaryExpr2) Flow

func (b BinaryExpr2) Flow(g *graphBuilder) (head Step)

func (BinaryExpr2) Pos

func (b BinaryExpr2) Pos() token.Pos

func (BinaryExpr2) String

func (b BinaryExpr2) String() string

type BinaryExprFunc

type BinaryExprFunc func(x, y reflect.Value) reflect.Value

type BinaryExprValue

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

func (BinaryExprValue) BoolEval

func (b BinaryExprValue) BoolEval(left bool) reflect.Value

func (BinaryExprValue) ComplexOpComplex

func (b BinaryExprValue) ComplexOpComplex(left, right complex128) reflect.Value

func (BinaryExprValue) Eval

func (b BinaryExprValue) Eval() reflect.Value

func (BinaryExprValue) FloatEval

func (b BinaryExprValue) FloatEval(left float64) reflect.Value

func (BinaryExprValue) FloatOpFloat

func (b BinaryExprValue) FloatOpFloat(left float64, right float64) reflect.Value

func (BinaryExprValue) IntEval

func (b BinaryExprValue) IntEval(left int64) reflect.Value

func (BinaryExprValue) IntOpInt

func (b BinaryExprValue) IntOpInt(left int64, right int64) reflect.Value

func (BinaryExprValue) InterfaceEval

func (b BinaryExprValue) InterfaceEval(left reflect.Value) reflect.Value

func (BinaryExprValue) PointerEval

func (b BinaryExprValue) PointerEval(left reflect.Value) reflect.Value

func (BinaryExprValue) StringEval

func (b BinaryExprValue) StringEval(left string) reflect.Value

func (BinaryExprValue) UIntEval

func (b BinaryExprValue) UIntEval(left uint64) reflect.Value

func (BinaryExprValue) UIntOpUInt

func (b BinaryExprValue) UIntOpUInt(left uint64, right uint64) reflect.Value

func (BinaryExprValue) UntypedNilEval

func (b BinaryExprValue) UntypedNilEval(left reflect.Value) reflect.Value

type BlockStmt

type BlockStmt struct {
	LbracePos token.Pos // position of "{"
	List      []Stmt
}

func (BlockStmt) Eval

func (b BlockStmt) Eval(vm *VM)

func (BlockStmt) Flow

func (b BlockStmt) Flow(g *graphBuilder) (head Step)

func (BlockStmt) Pos

func (b BlockStmt) Pos() token.Pos

func (BlockStmt) String

func (b BlockStmt) String() string

type BranchStmt

type BranchStmt struct {
	TokPos token.Pos   // position of Tok
	Tok    token.Token // keyword token (BREAK, CONTINUE, GOTO, FALLTHROUGH)
	Label  *Ident
}

BranchStmt represents a break, continue, goto, or fallthrough statement.

func (BranchStmt) Eval

func (s BranchStmt) Eval(vm *VM)

func (BranchStmt) Flow

func (s BranchStmt) Flow(g *graphBuilder) (head Step)

func (BranchStmt) Pos

func (s BranchStmt) Pos() token.Pos

func (BranchStmt) String

func (s BranchStmt) String() string

type CallExpr

type CallExpr struct {
	Lparen token.Pos // position of "("
	Fun    Expr
	Args   []Expr // function arguments; or nil
}

func (CallExpr) Eval

func (c CallExpr) Eval(vm *VM)

func (CallExpr) Flow

func (c CallExpr) Flow(g *graphBuilder) (head Step)

func (CallExpr) Pos

func (c CallExpr) Pos() token.Pos

func (CallExpr) String

func (c CallExpr) String() string

type CanAssign

type CanAssign interface {
	// =
	Assign(vm *VM, value reflect.Value)
	// :=
	Define(vm *VM, value reflect.Value)
}

type CanCompose

type CanCompose interface {
	LiteralCompose(vm *VM, composite reflect.Value, values []reflect.Value) reflect.Value
}

type CanDeclare

type CanDeclare interface {
	// Declare declares the variable in the current environment.
	// It returns true if the declaration set a valid reflect Value.
	Declare(vm *VM) bool
	CallGraph() Step
}

TODO only ValueSpec implements CanDeclare

type CanMake

type CanMake interface {
	// size can be 0 if not applicable
	// constructorArgs can be nil if not applicable
	Make(vm *VM, size int, constructorArgs []reflect.Value) reflect.Value
	CanCompose
}

type CanSelect

type CanSelect interface {
	Select(name string) reflect.Value
}

CanSelect is implemented by types that support selection of fields or methods by name.

type CaseClause

type CaseClause struct {
	CasePos token.Pos // position of "case" or "default" keyword
	List    []Expr    // list of expressions; nil means default case
	Body    []Stmt
}

A CaseClause represents a case of an expression or type switch statement.

func (CaseClause) Eval

func (c CaseClause) Eval(vm *VM)

func (CaseClause) Flow

func (c CaseClause) Flow(g *graphBuilder) (head Step)

func (CaseClause) Pos

func (c CaseClause) Pos() token.Pos

func (CaseClause) String

func (c CaseClause) String() string

type ChanType

type ChanType struct {
	Begin token.Pos   // position of "chan" keyword or "<-" (whichever comes first)
	Arrow token.Pos   // position of "<-" (token.NoPos if there is no "<-")
	Dir   ast.ChanDir // channel direction
	Value Expr        // value type
}

func (ChanType) Eval

func (c ChanType) Eval(vm *VM)

func (ChanType) Flow

func (c ChanType) Flow(g *graphBuilder) (head Step)

func (ChanType) LiteralCompose

func (c ChanType) LiteralCompose(vm *VM, composite reflect.Value, values []reflect.Value) reflect.Value

func (ChanType) Make

func (c ChanType) Make(vm *VM, buffer int, constructorArgs []reflect.Value) reflect.Value

func (ChanType) Pos

func (c ChanType) Pos() token.Pos

func (ChanType) String

func (c ChanType) String() string

type CompositeLit

type CompositeLit struct {
	Lbrace     token.Pos  // position of "{"
	Type       Expr       // literal type; or nil
	ParserType types.Type // literal type; or nil
	Elts       []Expr     // list of composite elements; or nil
}

func (CompositeLit) Eval

func (c CompositeLit) Eval(vm *VM)

func (CompositeLit) Flow

func (c CompositeLit) Flow(g *graphBuilder) (head Step)

func (CompositeLit) Pos

func (c CompositeLit) Pos() token.Pos

func (CompositeLit) String

func (c CompositeLit) String() string

type ConstDecl

type ConstDecl struct {
	Specs []ValueSpec
	// contains filtered or unexported fields
}

func (ConstDecl) CallGraph

func (c ConstDecl) CallGraph() Step

func (ConstDecl) Declare

func (c ConstDecl) Declare(vm *VM) bool

func (ConstDecl) Eval

func (c ConstDecl) Eval(vm *VM)

func (ConstDecl) Flow

func (c ConstDecl) Flow(g *graphBuilder) (head Step)

func (ConstDecl) Pos

func (c ConstDecl) Pos() token.Pos

func (ConstDecl) String

func (c ConstDecl) String() string

type Decl

type Decl interface {
	Flowable
	// contains filtered or unexported methods
}

type DeclStmt

type DeclStmt struct {
	*ast.DeclStmt // TODO
	Decl          Decl
}

func (DeclStmt) Eval

func (s DeclStmt) Eval(vm *VM)

func (DeclStmt) Flow

func (s DeclStmt) Flow(g *graphBuilder) (head Step)

func (DeclStmt) String

func (s DeclStmt) String() string

type DeferStmt

type DeferStmt struct {
	DeferPos token.Pos
	Call     Expr
	// contains filtered or unexported fields
}

func (DeferStmt) Eval

func (d DeferStmt) Eval(vm *VM)

func (DeferStmt) Flow

func (d DeferStmt) Flow(g *graphBuilder) (head Step)

func (DeferStmt) Pos

func (d DeferStmt) Pos() token.Pos

func (DeferStmt) String

func (d DeferStmt) String() string

type Ellipsis

type Ellipsis struct {
	*ast.Ellipsis
	Elt Expr // ellipsis element type (parameter lists only); or nil
}

func (Ellipsis) Eval

func (e Ellipsis) Eval(vm *VM)

func (Ellipsis) Flow

func (e Ellipsis) Flow(g *graphBuilder) (head Step)

func (Ellipsis) String

func (e Ellipsis) String() string

type Env

type Env interface {
	// contains filtered or unexported methods
}

type Environment

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

func (*Environment) String

func (e *Environment) String() string

type Evaluable

type Evaluable interface {
	Pos() token.Pos
	Eval(vm *VM)
}

type Expr

type Expr interface {
	Flowable
	Evaluable
}

type ExprStmt

type ExprStmt struct {
	*ast.ExprStmt
	X Expr
}

func (ExprStmt) Eval

func (s ExprStmt) Eval(vm *VM)

func (ExprStmt) Flow

func (s ExprStmt) Flow(g *graphBuilder) (head Step)

func (ExprStmt) String

func (s ExprStmt) String() string

type ExternalPackage

type ExternalPackage struct {
	SDKPackage
}

func (ExternalPackage) String

func (p ExternalPackage) String() string

type Field

type Field struct {
	Names []*Ident // field/method/(type) parameter names; or nil
	Type  Expr     // field/method/parameter type; or nil
	Tag   *string  // field tag; or nil
}

func (Field) Eval

func (l Field) Eval(vm *VM)

func (Field) Pos

func (l Field) Pos() token.Pos

func (Field) String

func (l Field) String() string

type FieldAssignable

type FieldAssignable interface {
	Assign(name string, val reflect.Value)
}

type FieldList

type FieldList struct {
	OpeningPos token.Pos
	List       []*Field
}

func (FieldList) Eval

func (l FieldList) Eval(vm *VM)

func (FieldList) Pos

func (l FieldList) Pos() token.Pos

func (FieldList) String

func (l FieldList) String() string

type Flowable

type Flowable interface {
	// Flow builds the control flow graph using the provided grapher.
	// Head is the entry point to that call flow graph.
	Flow(g *graphBuilder) (head Step)
}

type ForStmt

type ForStmt struct {
	ForPos token.Pos
	Init   Stmt
	Cond   Expr
	Post   Stmt
	Body   *BlockStmt
}

func (ForStmt) Eval

func (f ForStmt) Eval(vm *VM)

func (ForStmt) Flow

func (f ForStmt) Flow(g *graphBuilder) (head Step)

func (ForStmt) Pos

func (f ForStmt) Pos() token.Pos

func (ForStmt) String

func (f ForStmt) String() string

type Func

type Func interface {
	SetHasRecoverCall(bool)
	HasRecoverCall() bool
	PutGotoReference(label string, ref statementReference)
	GotoReference(label string) statementReference
	Results() *FieldList
	Params() *FieldList
}

FuncDecl and FuncLit implement this

type FuncDecl

type FuncDecl struct {
	Name *Ident
	Recv *FieldList // non-nil for methods
	Body *BlockStmt
	Type *FuncType
	// contains filtered or unexported fields
}

func (*FuncDecl) Eval

func (f *FuncDecl) Eval(vm *VM)

func (*FuncDecl) Flow

func (f *FuncDecl) Flow(g *graphBuilder) (head Step)

func (*FuncDecl) GotoReference

func (f *FuncDecl) GotoReference(label string) statementReference

func (*FuncDecl) HasRecoverCall

func (f *FuncDecl) HasRecoverCall() bool

func (*FuncDecl) Params

func (f *FuncDecl) Params() *FieldList

func (FuncDecl) Pos

func (f FuncDecl) Pos() token.Pos

func (*FuncDecl) PutGotoReference

func (f *FuncDecl) PutGotoReference(label string, ref statementReference)

func (*FuncDecl) Results

func (f *FuncDecl) Results() *FieldList

func (*FuncDecl) SetHasRecoverCall

func (f *FuncDecl) SetHasRecoverCall(bool)

func (FuncDecl) String

func (f FuncDecl) String() string

type FuncLit

type FuncLit struct {
	Type *FuncType
	Body *BlockStmt // TODO not sure what to do when Body and/or Type is nil
	// contains filtered or unexported fields
}

func (*FuncLit) Eval

func (f *FuncLit) Eval(vm *VM)

func (*FuncLit) Flow

func (f *FuncLit) Flow(g *graphBuilder) (head Step)

func (*FuncLit) GotoReference

func (f *FuncLit) GotoReference(label string) statementReference

func (*FuncLit) HasRecoverCall

func (f *FuncLit) HasRecoverCall() bool

func (*FuncLit) Params

func (f *FuncLit) Params() *FieldList

func (*FuncLit) Pos

func (f *FuncLit) Pos() token.Pos

func (*FuncLit) PutGotoReference

func (f *FuncLit) PutGotoReference(label string, ref statementReference)

func (*FuncLit) Results

func (f *FuncLit) Results() *FieldList

func (*FuncLit) SetHasRecoverCall

func (f *FuncLit) SetHasRecoverCall(bool)

func (*FuncLit) String

func (f *FuncLit) String() string

type FuncType

type FuncType struct {
	FuncPos    token.Pos
	TypeParams *FieldList // type parameters; or nil
	Params     *FieldList // (incoming) parameters; non-nil
	Results    *FieldList // (outgoing) results; or nil
}

func (FuncType) Eval

func (t FuncType) Eval(vm *VM)

func (FuncType) Flow

func (t FuncType) Flow(g *graphBuilder) (head Step)

func (FuncType) Pos

func (t FuncType) Pos() token.Pos

func (FuncType) String

func (t FuncType) String() string

type Heap

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

type HeapPointer

type HeapPointer struct {
	Addr       uintptr      // unique address in the heap
	Type       reflect.Type // type of the pointed-to value
	EnvRef     Env          // if non-nil, this points to a variable in an environment
	EnvVarName string       // the variable name in the environment
}

HeapPointer represents a pointer to a value stored in the VM's heap. This is used to handle pointer escape analysis - when a local variable's address is taken, it needs to survive beyond its scope.

func (HeapPointer) String

func (hp HeapPointer) String() string

String formats the HeapPointer to look like a real pointer address.

func (*HeapPointer) UnmarshalJSON

func (hp *HeapPointer) UnmarshalJSON(data []byte) error

type Ident

type Ident struct {
	NamePos token.Pos
	Name    string
}

func (Ident) Assign

func (i Ident) Assign(vm *VM, value reflect.Value)

func (Ident) Assignable

func (i Ident) Assignable(vm *VM) CanAssign

func (Ident) Define

func (i Ident) Define(vm *VM, value reflect.Value)

func (Ident) Eval

func (i Ident) Eval(vm *VM)

func (Ident) Flow

func (i Ident) Flow(g *graphBuilder) (head Step)

func (Ident) Pos

func (i Ident) Pos() token.Pos

func (Ident) String

func (i Ident) String() string

type IfStmt

type IfStmt struct {
	IfPos token.Pos
	Init  Stmt
	Cond  Expr
	Body  *BlockStmt
	Else  Stmt // else if ...
}

func (IfStmt) Eval

func (i IfStmt) Eval(vm *VM)

func (IfStmt) Flow

func (i IfStmt) Flow(g *graphBuilder) (head Step)

func (IfStmt) Pos

func (i IfStmt) Pos() token.Pos

func (IfStmt) String

func (i IfStmt) String() string

type IncDecFunc

type IncDecFunc func(v reflect.Value) reflect.Value

type IncDecStmt

type IncDecStmt struct {
	TokPos token.Pos   // position of Tok
	Tok    token.Token // INC or DEC
	X      Expr
}

func (IncDecStmt) Eval

func (i IncDecStmt) Eval(vm *VM)

func (IncDecStmt) Flow

func (i IncDecStmt) Flow(g *graphBuilder) (head Step)

func (IncDecStmt) Pos

func (i IncDecStmt) Pos() token.Pos

func (IncDecStmt) String

func (i IncDecStmt) String() string

type IndexExpr

type IndexExpr struct {
	Lbrack token.Pos // position of "["
	X      Expr
	Index  Expr
}

func (IndexExpr) Assign

func (i IndexExpr) Assign(vm *VM, value reflect.Value)

func (IndexExpr) Define

func (i IndexExpr) Define(vm *VM, value reflect.Value)

func (IndexExpr) Eval

func (i IndexExpr) Eval(vm *VM)

func (IndexExpr) Flow

func (i IndexExpr) Flow(g *graphBuilder) (head Step)

func (IndexExpr) Pos

func (i IndexExpr) Pos() token.Pos

func (IndexExpr) String

func (i IndexExpr) String() string

type KeyValueExpr

type KeyValueExpr struct {
	Colon token.Pos // position of ":"
	Key   Expr
	Value Expr
}

func (KeyValueExpr) Eval

func (k KeyValueExpr) Eval(vm *VM)

func (KeyValueExpr) Flow

func (k KeyValueExpr) Flow(g *graphBuilder) (head Step)

func (KeyValueExpr) Pos

func (k KeyValueExpr) Pos() token.Pos

func (KeyValueExpr) String

func (k KeyValueExpr) String() string

type LabeledStmt

type LabeledStmt struct {
	*ast.LabeledStmt
	ColonPos token.Pos
	Label    *Ident
	Stmt     Stmt
}

LabeledStmt represents a labeled statement. https://go.dev/ref/spec#Labeled_statements https://go.dev/ref/spec#Label_scopes

func (LabeledStmt) Eval

func (s LabeledStmt) Eval(vm *VM)

func (LabeledStmt) Flow

func (s LabeledStmt) Flow(g *graphBuilder) (head Step)

func (LabeledStmt) Pos

func (s LabeledStmt) Pos() token.Pos

func (LabeledStmt) String

func (s LabeledStmt) String() string

type MapType

type MapType struct {
	MapPos token.Pos
	Key    Expr
	Value  Expr
}

func (MapType) Eval

func (m MapType) Eval(vm *VM)

func (MapType) Flow

func (m MapType) Flow(g *graphBuilder) (head Step)

func (MapType) LiteralCompose

func (m MapType) LiteralCompose(vm *VM, composite reflect.Value, values []reflect.Value) reflect.Value

func (MapType) Make

func (m MapType) Make(vm *VM, _ int, constructorArgs []reflect.Value) reflect.Value

func (MapType) Pos

func (m MapType) Pos() token.Pos

func (MapType) String

func (m MapType) String() string

type Package

type Package struct {
	*packages.Package // TODO look for actual data used here
	Env               *PkgEnvironment
	Initialized       bool
}

func BuildPackage

func BuildPackage(goPkg *packages.Package) (*Package, error)

func ParseSource

func ParseSource(source string) (*Package, error)

func (*Package) Initialize

func (p *Package) Initialize(vm *VM) error

func (*Package) Select

func (p *Package) Select(name string) reflect.Value

func (*Package) String

func (p *Package) String() string

type ParenExpr

type ParenExpr struct {
	LParen token.Pos
	X      Expr
}

func (ParenExpr) Eval

func (e ParenExpr) Eval(vm *VM)

func (ParenExpr) Flow

func (e ParenExpr) Flow(g *graphBuilder) (head Step)

func (ParenExpr) Pos

func (e ParenExpr) Pos() token.Pos

func (ParenExpr) String

func (e ParenExpr) String() string

type PkgEnvironment

type PkgEnvironment struct {
	Env
	// contains filtered or unexported fields
}

func (*PkgEnvironment) String

func (p *PkgEnvironment) String() string

type RangeStmt

type RangeStmt struct {
	ForPos     token.Pos
	Tok        token.Token // ILLEGAL if Key == nil, ASSIGN, DEFINE
	Key, Value Expr        // Key, Value may be nil
	X          Expr
	XType      types.Type // depending on type, different flows are created
	Body       *BlockStmt
}

func (RangeStmt) Eval

func (r RangeStmt) Eval(vm *VM)

func (RangeStmt) Flow

func (r RangeStmt) Flow(g *graphBuilder) (head Step)

Flow builds the control flow graph for the RangeStmt. Based on the Kind of X, it will branch into one of three flows:

  • mapFlow for maps
  • sliceOrArrayFlow for slices and arrays
  • intFlow for integers
  • funcFlow for functions of type iter.Seq[V any], iter.Seq2[K comparable, V any]

All four flows converge to a done step. The last 3 subflows are transformed into a ForStmt that uses a hidden index variable.

func (RangeStmt) IntFlow

func (r RangeStmt) IntFlow(g *graphBuilder) (head Step)

func (RangeStmt) MapFlow

func (r RangeStmt) MapFlow(g *graphBuilder) (head Step)

func (RangeStmt) Pos

func (r RangeStmt) Pos() token.Pos

func (RangeStmt) SliceOrArrayFlow

func (r RangeStmt) SliceOrArrayFlow(g *graphBuilder) (head Step)

func (RangeStmt) String

func (r RangeStmt) String() string

type ReturnStmt

type ReturnStmt struct {
	ReturnPos token.Pos
	Results   []Expr
}

func (ReturnStmt) Eval

func (r ReturnStmt) Eval(vm *VM)

func (ReturnStmt) Flow

func (r ReturnStmt) Flow(g *graphBuilder) (head Step)

func (ReturnStmt) Pos

func (r ReturnStmt) Pos() token.Pos

func (ReturnStmt) String

func (r ReturnStmt) String() string

type SDKPackage

type SDKPackage struct {
	Name    string
	PkgPath string
	// contains filtered or unexported fields
}

func (SDKPackage) Select

func (p SDKPackage) Select(name string) reflect.Value

func (SDKPackage) String

func (p SDKPackage) String() string

type SelectorExpr

type SelectorExpr struct {
	*ast.SelectorExpr
	X Expr
}

func (SelectorExpr) Assign

func (s SelectorExpr) Assign(vm *VM, val reflect.Value)

func (SelectorExpr) Define

func (s SelectorExpr) Define(vm *VM, val reflect.Value)

func (SelectorExpr) Eval

func (s SelectorExpr) Eval(vm *VM)

func (SelectorExpr) Flow

func (s SelectorExpr) Flow(g *graphBuilder) (head Step)

func (SelectorExpr) String

func (s SelectorExpr) String() string

type SendStmt

type SendStmt struct {
	Arrow token.Pos
	Chan  Expr
	Value Expr
}

func (SendStmt) Eval

func (s SendStmt) Eval(vm *VM)

func (SendStmt) Flow

func (s SendStmt) Flow(g *graphBuilder) (head Step)

func (SendStmt) Pos

func (s SendStmt) Pos() token.Pos

func (SendStmt) String

func (s SendStmt) String() string

type SliceExpr

type SliceExpr struct {
	X      Expr      // expression
	Lbrack token.Pos // position of "["
	Low    Expr      // begin of slice range; or nil
	High   Expr      // end of slice range; or nil
	Max    Expr      // maximum capacity of slice; or nil
	// TODO handle this
	Slice3 bool // true if 3-index slice (2 colons present)
}

http://golang.org/ref/spec#Slice_expressions

func (SliceExpr) Eval

func (s SliceExpr) Eval(vm *VM)

func (SliceExpr) Flow

func (s SliceExpr) Flow(g *graphBuilder) (head Step)

func (SliceExpr) Pos

func (s SliceExpr) Pos() token.Pos

func (SliceExpr) String

func (s SliceExpr) String() string

type StarExpr

type StarExpr struct {
	StarPos token.Pos
	X       Expr
}

func (StarExpr) Assign

func (s StarExpr) Assign(vm *VM, value reflect.Value)

func (StarExpr) Define

func (s StarExpr) Define(vm *VM, value reflect.Value)

func (StarExpr) Eval

func (s StarExpr) Eval(vm *VM)

func (StarExpr) Flow

func (s StarExpr) Flow(g *graphBuilder) (head Step)

func (StarExpr) Pos

func (s StarExpr) Pos() token.Pos

func (StarExpr) String

func (s StarExpr) String() string

type Step

type Step interface {
	Evaluable
	StepTaker
	Traverseable

	// implemented by step
	Next() Step
	SetNext(s Step)
	ID() int
	SetID(id int)

	String() string
}

type StepTaker

type StepTaker interface {
	Take(vm *VM) Step
}

type Stmt

type Stmt interface {
	Flowable
	// contains filtered or unexported methods
}

All statement nodes implement the Stmt interface.

type StructType

type StructType struct {
	StructPos token.Pos
	Name      string
	Fields    *FieldList
	// contains filtered or unexported fields
}

func (StructType) Eval

func (s StructType) Eval(vm *VM)

func (StructType) Flow

func (s StructType) Flow(g *graphBuilder) (head Step)

func (StructType) LiteralCompose

func (s StructType) LiteralCompose(vm *VM, composite reflect.Value, values []reflect.Value) reflect.Value

func (StructType) Make

func (s StructType) Make(vm *VM, size int, constructorArgs []reflect.Value) reflect.Value

func (StructType) Pos

func (s StructType) Pos() token.Pos

func (StructType) String

func (s StructType) String() string

type StructValue

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

StructValue represents an instance of an interpreted struct.

func NewStructValue

func NewStructValue(vm *VM, t StructType) *StructValue

NewStructValue creates a new StructValue of the given StructType.

func (*StructValue) Assign

func (i *StructValue) Assign(fieldName string, val reflect.Value)

func (*StructValue) Format

func (i *StructValue) Format(f fmt.State, verb rune)

func (*StructValue) LiteralCompose

func (i *StructValue) LiteralCompose(vm *VM, composite reflect.Value, values []reflect.Value) reflect.Value

composite is (a reflect on) an StructValue

func (*StructValue) MarshalJSON

func (i *StructValue) MarshalJSON() ([]byte, error)

func (*StructValue) MarshalXML

func (i *StructValue) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

func (*StructValue) Select

func (i *StructValue) Select(name string) reflect.Value

TODO maybe return extra bool for ok?

func (*StructValue) String

func (i *StructValue) String() string

TODO must call String method of StructType if present and if not use default behavior

func (*StructValue) UnmarshalJSON

func (i *StructValue) UnmarshalJSON(data []byte) error

type StructValueWrapper

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

func (StructValueWrapper) Write

func (d StructValueWrapper) Write(b []byte) (n int, err error)

Write implements io.Writer

type SwitchStmt

type SwitchStmt struct {
	*ast.SwitchStmt
	Init Stmt // initialization statement; or nil
	Tag  Expr // tag expression; or nil
	Body BlockStmt
}

A SwitchStmt represents an expression switch statement.

func (SwitchStmt) Eval

func (s SwitchStmt) Eval(vm *VM)

func (SwitchStmt) Flow

func (s SwitchStmt) Flow(g *graphBuilder) (head Step)

func (SwitchStmt) String

func (s SwitchStmt) String() string

type Traverseable

type Traverseable interface {
	Traverse(g *dot.Graph, visited map[int]dot.Node) dot.Node
}

type TypeAssertExpr

type TypeAssertExpr struct {
	X      Expr
	Type   Expr // asserted type; nil means type switch X.(type)
	Lparen token.Pos
}

func (TypeAssertExpr) Eval

func (e TypeAssertExpr) Eval(vm *VM)

func (TypeAssertExpr) Flow

func (e TypeAssertExpr) Flow(g *graphBuilder) (head Step)

func (TypeAssertExpr) Pos

func (e TypeAssertExpr) Pos() token.Pos

func (TypeAssertExpr) String

func (e TypeAssertExpr) String() string

type TypeSpec

type TypeSpec struct {
	Name       *Ident
	TypeParams *FieldList
	Type       Expr
	AssignPos  token.Pos
}

func (TypeSpec) Eval

func (s TypeSpec) Eval(vm *VM)

func (TypeSpec) Flow

func (s TypeSpec) Flow(g *graphBuilder) (head Step)

func (TypeSpec) LiteralCompose

func (s TypeSpec) LiteralCompose(vm *VM, composite reflect.Value, values []reflect.Value) reflect.Value

func (TypeSpec) Make

func (s TypeSpec) Make(vm *VM, _ int, constructorArgs []reflect.Value) reflect.Value

func (TypeSpec) Pos

func (s TypeSpec) Pos() token.Pos

func (TypeSpec) String

func (s TypeSpec) String() string

type TypeSwitchStmt

type TypeSwitchStmt struct {
	SwitchPos token.Pos
	Init      Stmt // initialization statement; or nil
	Assign    Stmt // x := y.(type) or y.(type)
	Body      *BlockStmt
}

func (TypeSwitchStmt) Eval

func (s TypeSwitchStmt) Eval(vm *VM)

func (TypeSwitchStmt) Flow

func (s TypeSwitchStmt) Flow(g *graphBuilder) (head Step)

func (TypeSwitchStmt) Pos

func (s TypeSwitchStmt) Pos() token.Pos

func (TypeSwitchStmt) String

func (s TypeSwitchStmt) String() string

type UnaryExpr

type UnaryExpr struct {
	OpPos token.Pos   // position of Op
	Op    token.Token // operator
	X     Expr
	// contains filtered or unexported fields
}

func (UnaryExpr) Eval

func (u UnaryExpr) Eval(vm *VM)

func (UnaryExpr) Flow

func (u UnaryExpr) Flow(g *graphBuilder) (head Step)

func (UnaryExpr) Pos

func (u UnaryExpr) Pos() token.Pos

func (UnaryExpr) String

func (u UnaryExpr) String() string

type UnaryExprFunc

type UnaryExprFunc func(reflect.Value) reflect.Value

type VM

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

Runtime represents a virtual machine that can execute Go code.

func NewVM

func NewVM(env Env) *VM

type ValueSpec

type ValueSpec struct {
	NamePos token.Pos
	Names   []*Ident
	Type    Expr
	Values  []Expr
	// contains filtered or unexported fields
}

Const or Var declaration

func (ValueSpec) CallGraph

func (v ValueSpec) CallGraph() Step

func (ValueSpec) Declare

func (v ValueSpec) Declare(vm *VM) bool

func (ValueSpec) Eval

func (v ValueSpec) Eval(vm *VM)

func (ValueSpec) Flow

func (v ValueSpec) Flow(g *graphBuilder) (head Step)

func (ValueSpec) Pos

func (v ValueSpec) Pos() token.Pos

func (ValueSpec) String

func (v ValueSpec) String() string

Directories

Path Synopsis
perftests
tengobench command
walkprofile command
testexamples
stackonpanic command

Jump to

Keyboard shortcuts

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