mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 07:53:40 +00:00
reflect: implement Value.Elem() for interface values
This commit is contained in:
committed by
Ron Evans
parent
d15e32fb89
commit
823c9c25cf
Vendored
+5
@@ -120,6 +120,8 @@ func main() {
|
||||
&linkedList{
|
||||
foo: 42,
|
||||
},
|
||||
// interfaces
|
||||
[]interface{}{3, "str", -4 + 2.5i},
|
||||
} {
|
||||
showValue(reflect.ValueOf(v), "")
|
||||
}
|
||||
@@ -377,6 +379,9 @@ func showValue(rv reflect.Value, indent string) {
|
||||
case reflect.Interface:
|
||||
println(indent + " interface")
|
||||
println(indent+" nil:", rv.IsNil())
|
||||
if !rv.IsNil() {
|
||||
showValue(rv.Elem(), indent+" ")
|
||||
}
|
||||
case reflect.Map:
|
||||
println(indent + " map")
|
||||
println(indent+" nil:", rv.IsNil())
|
||||
|
||||
Reference in New Issue
Block a user