mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 03:27:48 +00:00
reflect: implement PtrTo
This commit is contained in:
committed by
Ron Evans
parent
36db75b366
commit
3010466c55
@@ -133,6 +133,14 @@ func TypeOf(i interface{}) Type {
|
||||
return ValueOf(i).typecode
|
||||
}
|
||||
|
||||
func PtrTo(t Type) Type {
|
||||
ptrType := t<<5 | 5 // 0b0101 == 5
|
||||
if ptrType>>5 != t {
|
||||
panic("reflect: PtrTo type does not fit")
|
||||
}
|
||||
return ptrType
|
||||
}
|
||||
|
||||
func (t Type) String() string {
|
||||
return "T"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user