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.
Этот коммит содержится в:
родитель
a531caa2e9
коммит
e930a1ead5
1 изменённых файлов: 0 добавлений и 3 удалений
|
@ -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
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче