Expr's functions now support parameters with default value

This commit is contained in:
2024-06-01 19:56:40 +02:00
parent f66cd1fdb1
commit 9bba40f155
12 changed files with 180 additions and 247 deletions
+2 -2
View File
@@ -168,11 +168,11 @@ func mulFunc(ctx ExprContext, name string, args []any) (result any, err error) {
func ImportMathFuncs(ctx ExprContext) {
ctx.RegisterFunc("add", &golangFunctor{f: addFunc}, typeNumber, []ExprFuncParam{
newFuncParamFlagDef(paramValue, pfOptional|pfRepeat, 0),
newFuncParamFlagDef(paramValue, pfOptional|pfRepeat, int64(0)),
})
ctx.RegisterFunc("mul", &golangFunctor{f: mulFunc}, typeNumber, []ExprFuncParam{
newFuncParamFlagDef(paramValue, pfOptional|pfRepeat, 1),
newFuncParamFlagDef(paramValue, pfOptional|pfRepeat, int64(1)),
})
}