llgo/ssa: Call to support closure

This commit is contained in:
xushiwei
2024-05-03 23:49:52 +08:00
parent f1bb42f554
commit 809a400f57
6 changed files with 106 additions and 10 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)
}
}