build: separate compiler and libs

This commit is contained in:
Li Jie
2025-01-07 21:49:08 +08:00
parent b0123567cd
commit 1172e5bdce
559 changed files with 190 additions and 176 deletions

View File

@@ -0,0 +1,35 @@
package main
import (
"unsafe"
)
func main() {
println("hello")
check(demo)
}
func check(fn func()) {
var a any = demo
var b any = fn
fn1 := a.(func())
fn2 := b.(func())
println(a, b, fn, fn1, fn2, demo)
println(closurePtr(a) == closurePtr(b))
}
func closurePtr(a any) unsafe.Pointer {
return (*rtype)(unsafe.Pointer(&a)).ptr.fn
}
type rtype struct {
typ unsafe.Pointer
ptr *struct {
fn unsafe.Pointer
env unsafe.Pointer
}
}
func demo() {
println("demo")
}