Documentation
¶
Overview ¶
Package cpevelements provides elements for the interpreter for compeval.
Index ¶
- func NewArray(typ ir.ArrayType) evaluator.NumericalElement
- func NewFunc(fn ir.Func, recv *interp.Receiver) interp.Func
- func NewMacro(fn *ir.Macro, recv *interp.Receiver) interp.Func
- func NewRuntimeValue(file *ir.File, newFunc interp.NewFunc, store ir.Storage) (ir.Element, error)
- func NewVariable(src elements.StorageAt) ir.Element
- type Element
- type Macro
- type MacroImpl
- type SyntheticBuilder
- type SyntheticFunc
- type SyntheticFuncDecl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewArray ¶
func NewArray(typ ir.ArrayType) evaluator.NumericalElement
NewArray returns a new array from a code position and a type.
func NewRuntimeValue ¶
NewRuntimeValue creates a new runtime value given an expression in a file.
Types ¶
type Element ¶
type Element interface {
evaluator.NumericalElement
canonical.Comparable
fmt.Stringer
// CanonicalExpr returns the canonical expression used for comparison.
CanonicalExpr() canonical.Canonical
}
Element returned after an evaluation at compeval.
type Macro ¶
type Macro struct {
// contains filtered or unexported fields
}
Macro is a macro function to build synthetic functions.
func (*Macro) Call ¶
func (f *Macro) Call(fctx *interp.FileScope, call *ir.CallExpr, args []ir.Element) ([]ir.Element, error)
Call the macro to build the synthetic element.
type SyntheticBuilder ¶
type SyntheticBuilder interface {
BuildType() (*ast.FuncDecl, error)
BuildBody(ir.Fetcher) (*ast.BlockStmt, []*SyntheticFuncDecl, bool)
BuildIR(fmterr.ErrAppender, *ast.FuncDecl, *ir.File, *ir.FuncType) (ir.PkgFunc, bool)
}
SyntheticBuilder builds a synthetic function.
type SyntheticFunc ¶
type SyntheticFunc struct {
// contains filtered or unexported fields
}
SyntheticFunc is a GX string.
func NewSyntheticFunc ¶
func NewSyntheticFunc(builder SyntheticBuilder) *SyntheticFunc
NewSyntheticFunc returns a state element storing a string GX value.
func (*SyntheticFunc) Builder ¶
func (n *SyntheticFunc) Builder() SyntheticBuilder
Builder returns the builder responsible for building the synthetic function.
func (*SyntheticFunc) Type ¶ added in v0.3.0
func (n *SyntheticFunc) Type() ir.Type
Type of the element.
type SyntheticFuncDecl ¶ added in v0.2.0
type SyntheticFuncDecl struct {
*SyntheticFunc
F *ast.FuncDecl
}
SyntheticFuncDecl is a synthetic package function declaration.