Documentation
¶
Overview ¶
Package cpevelements provides elements for the interpreter for compeval.
Index ¶
- func NewArray(src elements.ExprAt, typ ir.ArrayType) elements.NumericalElement
- func NewFunc(fn ir.Func, recv *elements.Receiver) elements.Func
- func NewMacro(fn *ir.Macro, recv *elements.Receiver) elements.Func
- func NewRuntimeValue(ctx evaluator.Context, src ir.AssignableExpr) (elements.Element, error)
- func NewVariable(src elements.StorageAt) elements.Element
- type Element
- type IRArrayElement
- type Macro
- func (f *Macro) Call(fctx elements.FileContext, call *ir.CallExpr, args []elements.Element) ([]elements.Element, error)
- func (f *Macro) Flatten() ([]elements.Element, error)
- func (f *Macro) Func() ir.Func
- func (f *Macro) Kind() ir.Kind
- func (f *Macro) Recv() *elements.Receiver
- func (f *Macro) Unflatten(handles *elements.Unflattener) (values.Value, error)
- type MacroImpl
- type SyntheticBuilder
- type SyntheticFunc
- type SyntheticFuncDecl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRuntimeValue ¶
NewRuntimeValue creates a new runtime value given an expression in a file.
Types ¶
type Element ¶
type Element interface {
elements.NumericalElement
canonical.Comparable
fmt.Stringer
// CanonicalExpr returns the canonical expression used for comparison.
CanonicalExpr() canonical.Canonical
}
Element returned after an evaluation at compeval.
type IRArrayElement ¶
IRArrayElement is an array with a IR representation of its axes.
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 elements.FileContext, call *ir.CallExpr, args []elements.Element) ([]elements.Element, error)
Call the macro to build the synthetic element.
type MacroImpl ¶
type MacroImpl func(call elements.CallAt, fn *Macro, args []elements.Element) (*SyntheticFunc, error)
MacroImpl is a builtin opaque function to produce an IR.
type SyntheticBuilder ¶
type SyntheticBuilder interface {
BuildType() (*ir.FuncType, error)
BuildBody(ir.Fetcher) (*ir.BlockStmt, []*SyntheticFuncDecl, 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) Flatten ¶
func (n *SyntheticFunc) Flatten() ([]elements.Element, error)
Flatten returns the element in a slice of elements.
func (*SyntheticFunc) Unflatten ¶
func (n *SyntheticFunc) Unflatten(handles *elements.Unflattener) (values.Value, error)
Unflatten consumes the next handles to return a GX value.
type SyntheticFuncDecl ¶ added in v0.2.0
type SyntheticFuncDecl struct {
*SyntheticFunc
F *ir.FuncDecl
}
SyntheticFuncDecl is a synthetic package function declaration.