diff options
author | Ayke van Laethem <[email protected]> | 2019-08-16 22:08:44 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2019-08-19 11:08:26 +0200 |
commit | c19c738f523be8665a0e84c7905a6e0600f56404 (patch) | |
tree | 18bd35817d48a6cf7b42052c18dc8a87ab818095 /testdata/reflect.go | |
parent | bbc3046687ffa5bc166cb15a2bc1149192f6f203 (diff) | |
download | tinygo-c19c738f523be8665a0e84c7905a6e0600f56404.tar.gz tinygo-c19c738f523be8665a0e84c7905a6e0600f56404.zip |
reflect: implement support for array types
Diffstat (limited to 'testdata/reflect.go')
-rw-r--r-- | testdata/reflect.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/testdata/reflect.go b/testdata/reflect.go index 314f112c3..8377f95c9 100644 --- a/testdata/reflect.go +++ b/testdata/reflect.go @@ -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()) |