lang: funcs: Verify that simple polyfunc list is not empty
This could prevent some incorrect usage of the simplepoly API.
This commit is contained in:
@@ -42,6 +42,10 @@ func Register(name string, fns []*types.FuncValue) {
|
|||||||
panic(fmt.Sprintf("a simple polyfunc named %s is already registered", name))
|
panic(fmt.Sprintf("a simple polyfunc named %s is already registered", name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(fns) == 0 {
|
||||||
|
panic("no functions specified for simple polyfunc")
|
||||||
|
}
|
||||||
|
|
||||||
// check for uniqueness in type signatures
|
// check for uniqueness in type signatures
|
||||||
typs := []*types.Type{}
|
typs := []*types.Type{}
|
||||||
for _, f := range fns {
|
for _, f := range fns {
|
||||||
|
|||||||
Reference in New Issue
Block a user