Fixed incorrect number of history entries
This commit is contained in:
parent
77d354936c
commit
5f8b859f4a
9 changed files with 39 additions and 20 deletions
|
@ -8,9 +8,8 @@ import (
|
|||
|
||||
// CompileReturn compiles a return instruction.
|
||||
func (f *Function) CompileReturn(node *ast.Return) error {
|
||||
defer f.Return()
|
||||
|
||||
if len(node.Values) == 0 {
|
||||
f.Return()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -27,12 +26,13 @@ func (f *Function) CompileReturn(node *ast.Return) error {
|
|||
|
||||
if !types.Is(typ, f.Output[i].Type) {
|
||||
if f.Package == "mem" && f.Name == "alloc" {
|
||||
return nil
|
||||
continue
|
||||
}
|
||||
|
||||
return errors.New(&errors.TypeMismatch{Encountered: typ.Name(), Expected: f.Output[i].Type.Name(), ParameterName: "", IsReturn: true}, f.File, node.Values[i].Token.Position)
|
||||
}
|
||||
}
|
||||
|
||||
f.Return()
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue