defer support; llgo/ssa: IfThen

This commit is contained in:
xushiwei
2024-06-02 14:29:35 +08:00
parent e151bd4cd1
commit 5a5929048d
11 changed files with 328 additions and 37 deletions

25
cl/_testgo/defer/in.go Normal file
View 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
View File