runtime: MakeAnyString
This commit is contained in:
@@ -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}},
|
||||
|
||||
@@ -47,6 +47,7 @@ var (
|
||||
abi.Float64: basicType(abi.Float64),
|
||||
abi.Complex64: basicType(abi.Complex64),
|
||||
abi.Complex128: basicType(abi.Complex128),
|
||||
abi.String: basicType(abi.String),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -68,6 +69,7 @@ var (
|
||||
abi.Float64: 8,
|
||||
abi.Complex64: 8,
|
||||
abi.Complex128: 16,
|
||||
abi.String: unsafe.Sizeof(String{}),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user