Generate phi node for default case in match switch
This commit is contained in:
parent
7154f5d333
commit
2f251b8274
@ -150,6 +150,12 @@ func (this *generator) generateMatch (match *entity.Match, mode resultMode) (llv
|
||||
if mode == resultModeAny {
|
||||
return nil, false, nil
|
||||
} else {
|
||||
irType, err := this.generateType(match.Type())
|
||||
if err != nil { return nil, false, err }
|
||||
irIncomings = append(irIncomings, &llvm.Incoming {
|
||||
X: llvm.NewConstZeroInitializer(irType),
|
||||
Predecessor: previousBlock,
|
||||
})
|
||||
return this.blockManager.NewPhi(irIncomings...), loc, nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user