runtime: MakeAnyString

This commit is contained in:
xushiwei
2024-04-28 10:29:06 +08:00
parent 7039cb3bc2
commit 0d68066086
4 changed files with 27 additions and 16 deletions

View File

@@ -37,6 +37,13 @@ func MakeAnyInt(typ *Type, data uintptr) Interface {
}
}
func MakeAnyString(data string) Interface {
return Interface{
tab: &itab{inter: TyAny, _type: Basic(abi.String), hash: 0, fun: [1]uintptr{0}},
data: unsafe.Pointer(&data),
}
}
func MakeAny(typ *Type, data unsafe.Pointer) Interface {
return Interface{
tab: &itab{inter: TyAny, _type: typ, hash: 0, fun: [1]uintptr{0}},