From e930a1ead57632c088521c7af52b64ae6e6699a4 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sat, 3 Nov 2018 20:22:00 +0100 Subject: [PATCH] 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. --- compiler/compiler.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/compiler/compiler.go b/compiler/compiler.go index 731d0948..c030418c 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -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