ExprContext.SetVar() no longer requires the explicit specification of the type of number

This commit is contained in:
2024-04-09 07:12:22 +02:00
parent bd323efedf
commit 8f396a35de
8 changed files with 42 additions and 13 deletions
+3 -3
View File
@@ -57,7 +57,7 @@ func exportVar(ctx ExprContext, name string, value any) {
if name[0] == '@' {
name = name[1:]
}
ctx.SetVar(name, value)
ctx.setVar(name, value)
}
func exportFunc(ctx ExprContext, name string, info ExprFunc) {
@@ -89,9 +89,9 @@ type funcDefFunctor struct {
func (functor *funcDefFunctor) Invoke(ctx ExprContext, name string, args []any) (result any, err error) {
for i, p := range functor.params {
if i < len(args) {
ctx.SetVar(p, args[i])
ctx.setVar(p, args[i])
} else {
ctx.SetVar(p, nil)
ctx.setVar(p, nil)
}
}
result, err = functor.expr.eval(ctx, false)