mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 21:13:39 +00:00
reflect: implement support for array types
This commit is contained in:
committed by
Ron Evans
parent
bbc3046687
commit
c19c738f52
Vendored
+6
-2
@@ -91,7 +91,8 @@ func main() {
|
||||
[]complex128{1, 1.128 + 0.4i},
|
||||
myslice{5, 3, 11},
|
||||
// array
|
||||
[4]int{1, 2, 3, 4},
|
||||
[3]int64{5, 8, 2},
|
||||
[2]uint8{3, 5},
|
||||
// functions
|
||||
zeroFunc,
|
||||
emptyFunc,
|
||||
@@ -287,7 +288,10 @@ func showValue(rv reflect.Value, indent string) {
|
||||
case reflect.UnsafePointer:
|
||||
println(indent+" pointer:", rv.Pointer() != 0)
|
||||
case reflect.Array:
|
||||
println(indent + " array")
|
||||
println(indent+" array:", rt.Len(), rt.Elem().Kind().String(), int(rt.Size()))
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
showValue(rv.Index(i), indent+" ")
|
||||
}
|
||||
case reflect.Chan:
|
||||
println(indent+" chan:", rt.Elem().Kind().String())
|
||||
println(indent+" nil:", rv.IsNil())
|
||||
|
||||
Reference in New Issue
Block a user