abiType: support pointer

This commit is contained in:
xushiwei
2024-05-24 22:47:45 +08:00
parent 9b4701fed7
commit 3cc975813d
8 changed files with 201 additions and 106 deletions

Binary file not shown.

View File

@@ -111,4 +111,17 @@ func Struct(size uintptr, pkgPath string, fields ...abi.StructField) *Type {
return &ret.Type
}
// Pointer returns a pointer type.
func Pointer(elem *Type) *Type {
ret := &abi.PtrType{
Type: Type{
Size_: unsafe.Sizeof(uintptr(0)),
Hash: uint32(abi.Pointer), // TODO(xsw): hash
Kind_: uint8(abi.Pointer),
},
Elem: elem,
}
return &ret.Type
}
// -----------------------------------------------------------------------------