40 lines
807 B
Go
40 lines
807 B
Go
// simple-var-store.go
|
|
package expr
|
|
|
|
type SimpleVarStore struct {
|
|
store map[string]any
|
|
}
|
|
|
|
func NewSimpleVarStore() *SimpleVarStore {
|
|
return &SimpleVarStore{
|
|
store: make(map[string]any),
|
|
}
|
|
}
|
|
|
|
func (ctx *SimpleVarStore) Clone() (clone exprContext) {
|
|
clone = &SimpleVarStore{
|
|
store: CloneMap(ctx.store),
|
|
}
|
|
return clone
|
|
}
|
|
|
|
func (ctx *SimpleVarStore) GetVar(varName string) (v any, exists bool) {
|
|
v, exists = ctx.store[varName]
|
|
return
|
|
}
|
|
|
|
func (ctx *SimpleVarStore) SetVar(varName string, value any) {
|
|
ctx.store[varName] = value
|
|
}
|
|
|
|
func (ctx *SimpleVarStore) GetFuncInfo(name string) (f exprFunc) {
|
|
return
|
|
}
|
|
|
|
func (ctx *SimpleVarStore) Call(name string, args []any) (result any, err error) {
|
|
return
|
|
}
|
|
|
|
func (ctx *SimpleVarStore) RegisterFunc(name string, functor Functor, minArgs, maxArgs int) {
|
|
}
|