fix: check the number of argument passed and returned to functions

This commit is contained in:
Marc Vertes
2020-05-19 14:56:04 +02:00
committed by GitHub
parent 6f4643ff19
commit 4f8e1de267
6 changed files with 89 additions and 4 deletions

View File

@@ -706,10 +706,15 @@ func (t *itype) referTo(name string, seen map[*itype]bool) bool {
}
func (t *itype) numOut() int {
if t.cat == valueT {
return t.rtype.NumOut()
switch t.cat {
case funcT:
return len(t.ret)
case valueT:
if t.rtype.Kind() == reflect.Func {
return t.rtype.NumOut()
}
}
return len(t.ret)
return 1
}
func (t *itype) concrete() *itype {