mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
compiler: allow multiple basic blocks in package initializers
I don't know why they sometimes have them, but apparently some packages do. Don't panic in that case, the interpreter will stop anyway on the first branch.
This commit is contained in:
@@ -289,9 +289,6 @@ func (c *Compiler) Compile(mainPath string) error {
|
||||
for _, frame := range frames {
|
||||
if frame.fn.Synthetic == "package initializer" {
|
||||
c.initFuncs = append(c.initFuncs, frame.fn.LLVMFn)
|
||||
if len(frame.fn.Blocks) != 1 {
|
||||
panic("unexpected number of basic blocks in package initializer")
|
||||
}
|
||||
// Try to interpret as much as possible of the init() function.
|
||||
// Whenever it hits an instruction that it doesn't understand, it
|
||||
// bails out and leaves the rest to the compiler (so initialization
|
||||
|
||||
Reference in New Issue
Block a user