RegisterFunc() also returns the funcInfo object

This commit is contained in:
2024-08-01 00:09:49 +02:00
parent 3c51b8d2ee
commit 075b0b5691
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -149,10 +149,11 @@ func (ctx *SimpleStore) RegisterFuncInfo(info ExprFunc) {
ctx.funcStore[info.Name()], _ = info.(*funcInfo)
}
func (ctx *SimpleStore) RegisterFunc(name string, functor Functor, returnType string, params []ExprFuncParam) (err error) {
func (ctx *SimpleStore) RegisterFunc(name string, functor Functor, returnType string, params []ExprFuncParam) (exprFunc ExprFunc, err error) {
var info *funcInfo
if info, err = newFuncInfo(name, functor, returnType, params); err == nil {
ctx.funcStore[name] = info
exprFunc = info
}
return
}