mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 20:43:40 +00:00
Try to interpret simple function calls in init() functions
This is useful for example for globals like these:
import "errors"
var MyError = errors.New("mymodule: something went wrong!")
This commit is contained in:
@@ -1036,6 +1036,9 @@ func (c *Compiler) parseFunc(frame *Frame) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if frame.fn.fn.Name() == "init" && len(block.Instrs) == 0 {
|
||||
c.builder.CreateRetVoid()
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve phi nodes
|
||||
|
||||
Reference in New Issue
Block a user