mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
reflect: add Addr()
This commit is contained in:
committed by
Damian Gryski
parent
bbc79ee40a
commit
79930a209c
@@ -217,7 +217,15 @@ func (v Value) CanAddr() bool {
|
||||
}
|
||||
|
||||
func (v Value) Addr() Value {
|
||||
panic("unimplemented: (reflect.Value).Addr()")
|
||||
if !v.CanAddr() {
|
||||
panic("reflect.Value.Addr of unaddressable value")
|
||||
}
|
||||
|
||||
return Value{
|
||||
typecode: pointerTo(v.typecode),
|
||||
value: unsafe.Pointer(&v.value),
|
||||
flags: v.flags ^ valueFlagIndirect,
|
||||
}
|
||||
}
|
||||
|
||||
func (v Value) CanSet() bool {
|
||||
|
||||
Reference in New Issue
Block a user