New interface and implementation to model function parameters
This commit is contained in:
+9
-2
@@ -167,8 +167,15 @@ func mulFunc(ctx ExprContext, name string, args []any) (result any, err error) {
|
||||
}
|
||||
|
||||
func ImportMathFuncs(ctx ExprContext) {
|
||||
ctx.RegisterFunc("add", &simpleFunctor{f: addFunc}, 0, -1)
|
||||
ctx.RegisterFunc("mul", &simpleFunctor{f: mulFunc}, 0, -1)
|
||||
//ctx.RegisterFunc("add", &simpleFunctor{f: addFunc}, 0, -1)
|
||||
ctx.RegisterFunc2("add", &simpleFunctor{f: addFunc}, typeNumber, []ExprFuncParam{
|
||||
newFuncParamFlagDef(paramValue, pfOptional|pfRepeat, 0),
|
||||
})
|
||||
|
||||
// ctx.RegisterFunc("mul", &simpleFunctor{f: mulFunc}, 0, -1)
|
||||
ctx.RegisterFunc2("mul", &simpleFunctor{f: mulFunc}, typeNumber, []ExprFuncParam{
|
||||
newFuncParamFlagDef(paramValue, pfOptional|pfRepeat, 1),
|
||||
})
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
Reference in New Issue
Block a user