llgo/ssa: checkExpr to auto convert funcPtr into closure

This commit is contained in:
xushiwei
2024-05-04 17:25:13 +08:00
parent 9f25d73826
commit c0ef1598c9
7 changed files with 52 additions and 58 deletions

20
cl/_testrt/intgen/in.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"github.com/goplus/llgo/internal/runtime/c"
)
func genInts(n int, gen func() c.Int) []c.Int {
a := make([]c.Int, n)
for i := range a {
a[i] = gen()
}
return a
}
func main() {
a := genInts(5, c.Rand)
for _, v := range a {
c.Printf(c.Str("%d\n"), v)
}
}