build: separate compiler and libs
This commit is contained in:
56
compiler/cl/_testrt/abinamed/in.go
Normal file
56
compiler/cl/_testrt/abinamed/in.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/goplus/llgo/compiler/internal/abi"
|
||||
)
|
||||
|
||||
type T struct {
|
||||
p *T
|
||||
t *abi.Type
|
||||
n uintptr
|
||||
a []T
|
||||
}
|
||||
|
||||
type eface struct {
|
||||
typ *abi.Type
|
||||
data unsafe.Pointer
|
||||
}
|
||||
|
||||
func toEface(i any) *eface {
|
||||
return (*eface)(unsafe.Pointer(&i))
|
||||
}
|
||||
|
||||
func main() {
|
||||
e := toEface(T{})
|
||||
e2 := toEface(abi.Type{})
|
||||
|
||||
println(e.typ)
|
||||
println(e.typ.PtrToThis_)
|
||||
println(e2.typ)
|
||||
println(e2.typ.PtrToThis_)
|
||||
|
||||
f0 := e.typ.StructType().Fields[0]
|
||||
if f0.Typ != e.typ.PtrToThis_ {
|
||||
panic("error field 0")
|
||||
}
|
||||
if f0.Typ.Elem() != e.typ {
|
||||
panic("error field 0 elem")
|
||||
}
|
||||
f1 := e.typ.StructType().Fields[1]
|
||||
if f1.Typ != e2.typ.PtrToThis_ {
|
||||
panic("error field 1")
|
||||
}
|
||||
if f1.Typ.Elem() != e2.typ {
|
||||
panic("error field 1 elem")
|
||||
}
|
||||
f2 := e.typ.StructType().Fields[2]
|
||||
if f2.Typ != e2.typ.StructType().Fields[0].Typ {
|
||||
panic("error field 2")
|
||||
}
|
||||
f3 := e.typ.StructType().Fields[3]
|
||||
if f3.Typ.Elem() != e.typ {
|
||||
panic("error field 3")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user