From 2857b90d13daf61e78ec755312e7f83e400878cc Mon Sep 17 00:00:00 2001 From: xushiwei Date: Mon, 1 Jul 2024 18:49:50 +0800 Subject: [PATCH] llgo: reflect --- testdata/_llgo/reflect/reflect.gop | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 testdata/_llgo/reflect/reflect.gop diff --git a/testdata/_llgo/reflect/reflect.gop b/testdata/_llgo/reflect/reflect.gop new file mode 100644 index 000000000..3be53152a --- /dev/null +++ b/testdata/_llgo/reflect/reflect.gop @@ -0,0 +1,12 @@ +import ( + "c" + "reflect" +) + +tyIntSlice := reflect.sliceOf(reflect.typeOf(0)) +v := reflect.zero(tyIntSlice) +v = reflect.append(v, reflect.valueOf(1), reflect.valueOf(2), reflect.valueOf(3)) +for i, n := 0, v.len; i < n; i++ { + item := v.index(i) + c.Printf c"%d\n", item.int +}