operand-func.go: commented the errors moved to common-errors..go
This commit is contained in:
parent
6786666cf4
commit
8138cd2a80
@ -25,14 +25,10 @@ func newFuncCallTerm(tk *Token, args []*term) *term {
|
|||||||
func checkFunctionCall(ctx ExprContext, name string, params []any) (err error) {
|
func checkFunctionCall(ctx ExprContext, name string, params []any) (err error) {
|
||||||
if info, exists, owner := GetFuncInfo(ctx, name); exists {
|
if info, exists, owner := GetFuncInfo(ctx, name); exists {
|
||||||
if info.MinArgs() > len(params) {
|
if info.MinArgs() > len(params) {
|
||||||
if info.MaxArgs() < 0 {
|
err = errTooFewParams(info.MinArgs(), info.MaxArgs(), len(params))
|
||||||
err = fmt.Errorf("too few params -- expected %d or more, got %d", info.MinArgs(), len(params))
|
|
||||||
} else {
|
|
||||||
err = fmt.Errorf("too few params -- expected %d, got %d", info.MinArgs(), len(params))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if err == nil && info.MaxArgs() >= 0 && info.MaxArgs() < len(params) {
|
if err == nil && info.MaxArgs() >= 0 && info.MaxArgs() < len(params) {
|
||||||
err = fmt.Errorf("too much params -- expected %d, got %d", info.MaxArgs(), len(params))
|
err = errTooMuchParams(info.MaxArgs(), len(params))
|
||||||
}
|
}
|
||||||
if err == nil && owner != ctx {
|
if err == nil && owner != ctx {
|
||||||
ctx.RegisterFunc(name, info.Functor(), info.MinArgs(), info.MaxArgs())
|
ctx.RegisterFunc(name, info.Functor(), info.MinArgs(), info.MaxArgs())
|
||||||
|
Loading…
Reference in New Issue
Block a user