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 ¶
- func CallPackageFunction(pkg *Package, functionName string, args []any, optionalVM *VM) ([]any, error)
- func GetModulePath(name, version string) (string, error)
- func LoadGoMod(filename string) (*modfile.File, error)
- func LoadPackage(dir string, optionalConfig *packages.Config) (*packages.Package, error)
- func OnOsExit(f func(int))
- func OnPanic(f func(any))
- func RegisterPackage(pkgPath string, symbols map[string]reflect.Value)
- type ArrayType
- type AssignStmt
- type BasicLit
- type BinaryExpr
- type BinaryExprFunc
- type BlockStmt
- type BranchStmt
- type CallExpr
- type CanAssign
- type CanCompose
- type CanDeclare
- type CanMake
- type CanSelect
- type CaseClause
- type ChanType
- type CompositeLit
- type ConstDecl
- type Decl
- type DeclStmt
- type DeferStmt
- type Ellipsis
- type Env
- type Environment
- type Evaluable
- type Expr
- type ExprStmt
- type ExtendedType
- type ExternalPackage
- type Field
- type FieldAssignable
- type FieldList
- type Flowable
- type ForStmt
- type Func
- type FuncDecl
- type FuncLit
- type FuncType
- type GoType
- type Heap
- type HeapPointer
- type Ident
- type IfStmt
- type IncDecFunc
- type IncDecStmt
- type IndexExpr
- type KeyValueExpr
- type LabeledStmt
- type MapType
- type Package
- type ParenExpr
- type PkgEnvironment
- type RangeStmt
- type ReturnStmt
- type SDKPackage
- type SelectorExpr
- type SendStmt
- type SliceExpr
- type StarExpr
- type Step
- type StepTaker
- type Stmt
- type StructType
- type StructValue
- type StructValueWrapper
- type SwitchStmt
- type Traverseable
- type TypeAssertExpr
- type TypeSpec
- type TypeSwitchStmt
- type UnaryExpr
- type UnaryExprFunc
- type VM
- type ValueSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallPackageFunction ¶
func GetModulePath ¶
https://stackoverflow.com/questions/67211875/how-to-get-the-path-to-a-go-module-dependency
func LoadPackage ¶
func OnOsExit ¶
func OnOsExit(f func(int))
OnOsExit sets the function to be called when os.Exit is invoked in the interpreted code. The Go SDK os.Exit is not called.
Types ¶
type ArrayType ¶
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) Pos ¶
func (a AssignStmt) Pos() token.Pos
func (AssignStmt) String ¶
func (a AssignStmt) String() string
type BinaryExpr ¶
type BinaryExpr struct {
OpPos token.Pos // position of Op
Op token.Token // operator
X Expr // left
Y Expr // right
// contains filtered or unexported fields
}
func (BinaryExpr) Eval ¶
func (b BinaryExpr) Eval(vm *VM)
func (BinaryExpr) Pos ¶
func (b BinaryExpr) Pos() token.Pos
func (BinaryExpr) String ¶
func (b BinaryExpr) 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) Pos ¶
func (s BranchStmt) Pos() token.Pos
func (BranchStmt) String ¶
func (s BranchStmt) String() string
type CallExpr ¶
type CanCompose ¶
type CanCompose interface {
// contains filtered or unexported methods
}
type CanDeclare ¶
type CanDeclare interface {
// contains filtered or unexported methods
}
TODO only ValueSpec implements CanDeclare
type CanMake ¶
type CanMake interface {
CanCompose
// contains filtered or unexported methods
}
type CanSelect ¶
type CanSelect interface {
// contains filtered or unexported methods
}
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) Pos ¶
func (c CaseClause) Pos() token.Pos
func (CaseClause) String ¶
func (c CaseClause) String() string
type ChanType ¶
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) 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
}
type Ellipsis ¶
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func (*Environment) String ¶
func (e *Environment) String() string
type ExtendedType ¶
type ExtendedType struct {
// contains filtered or unexported fields
}
type ExternalPackage ¶
type ExternalPackage struct {
SDKPackage
}
func (ExternalPackage) String ¶
func (p ExternalPackage) String() string
type Field ¶
type FieldAssignable ¶
type FieldAssignable interface {
// contains filtered or unexported methods
}
type Func ¶
type Func interface {
// contains filtered or unexported methods
}
FuncDecl and FuncLit implement this
type FuncDecl ¶
type FuncLit ¶
type FuncType ¶
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 (in gi terms: environment).
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 IncDecStmt ¶
func (IncDecStmt) Eval ¶
func (i IncDecStmt) Eval(vm *VM)
func (IncDecStmt) Pos ¶
func (i IncDecStmt) Pos() token.Pos
func (IncDecStmt) String ¶
func (i IncDecStmt) String() string
type KeyValueExpr ¶
func (KeyValueExpr) Eval ¶
func (k KeyValueExpr) Eval(vm *VM)
func (KeyValueExpr) Pos ¶
func (k KeyValueExpr) Pos() token.Pos
func (KeyValueExpr) String ¶
func (k KeyValueExpr) String() string
type LabeledStmt ¶
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) Pos ¶
func (s LabeledStmt) Pos() token.Pos
func (LabeledStmt) String ¶
func (s LabeledStmt) String() string
type Package ¶
type Package struct {
*packages.Package // TODO look for actual data used here
Env *PkgEnvironment
Initialized bool
}
func ParseSource ¶
func (*Package) Initialize ¶
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) SliceOrArrayFlow ¶
type ReturnStmt ¶
func (ReturnStmt) Eval ¶
func (r ReturnStmt) Eval(vm *VM)
func (ReturnStmt) Pos ¶
func (r ReturnStmt) Pos() token.Pos
func (ReturnStmt) String ¶
func (r ReturnStmt) String() string
type SDKPackage ¶
func (SDKPackage) String ¶
func (p SDKPackage) String() string
type SelectorExpr ¶
type SelectorExpr struct {
*ast.SelectorExpr
X Expr
}
func (SelectorExpr) Eval ¶
func (s SelectorExpr) Eval(vm *VM)
func (SelectorExpr) String ¶
func (s SelectorExpr) String() string
type SliceExpr ¶
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
}
StructType represents a struct type definition that is interpreted (IType).
func (StructType) Eval ¶
func (s StructType) Eval(vm *VM)
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) MarshalJSON ¶
func (i *StructValue) MarshalJSON() ([]byte, error)
func (*StructValue) MarshalXML ¶
func (i *StructValue) MarshalXML(enc *xml.Encoder, start xml.StartElement) error
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
}
type SwitchStmt ¶
type SwitchStmt struct {
SwitchPos token.Pos
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) Pos ¶
func (s SwitchStmt) Pos() token.Pos
func (SwitchStmt) String ¶
func (s SwitchStmt) String() string
type Traverseable ¶
type Traverseable interface {
// contains filtered or unexported methods
}
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) Pos ¶
func (e TypeAssertExpr) Pos() token.Pos
func (TypeAssertExpr) String ¶
func (e TypeAssertExpr) 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) Pos ¶
func (s TypeSwitchStmt) Pos() token.Pos
func (TypeSwitchStmt) String ¶
func (s TypeSwitchStmt) String() string
type UnaryExpr ¶
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
Runtime represents a virtual machine that can execute Go code.
Source Files
¶
- array.go
- assign.go
- ast_builder.go
- binary.go
- binary_funcs.go
- call.go
- call_builtin.go
- concurrency.go
- decl.go
- env.go
- field.go
- for.go
- func.go
- gomod.go
- graph_builder.go
- heap.go
- ident.go
- if.go
- incdec.go
- incdec_funcs.go
- index.go
- interfaces.go
- keyvalue.go
- literal.go
- package.go
- range.go
- return.go
- selector.go
- stack.go
- star.go
- stdlib_builtin_funcs.go
- stdlib_builtins.go
- stdlib_convert.go
- stdlib_funcs_generated.go
- stdlib_names_generated.go
- stdlib_types_generated.go
- step.go
- stmt.go
- struct_value.go
- struct_value_interfaces.go
- switch.go
- type.go
- unary.go
- unary_funcs.go
- utils.go
- var.go
- vm.go
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
perftests/tengobench
command
|
|
|
perftests/walkprofile
command
|
|
|
testexamples/stackonpanic
command
|