defer support; llgo/ssa: IfThen
This commit is contained in:
25
cl/_testgo/defer/in.go
Normal file
25
cl/_testgo/defer/in.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
func f(s string) bool {
|
||||
return len(s) > 5
|
||||
}
|
||||
|
||||
func fail() {
|
||||
panic("error")
|
||||
}
|
||||
|
||||
func main() {
|
||||
defer func() {
|
||||
println("hi")
|
||||
if e := recover(); e != nil {
|
||||
println(e.(string))
|
||||
}
|
||||
}()
|
||||
if s := "hello"; f(s) {
|
||||
defer println(s)
|
||||
} else {
|
||||
defer println("world")
|
||||
fail()
|
||||
}
|
||||
defer println("bye")
|
||||
}
|
||||
0
cl/_testgo/defer/out.ll
Normal file
0
cl/_testgo/defer/out.ll
Normal file
Reference in New Issue
Block a user