Browse Source

Merge pull request #4135 from gelatinstudios/master

fix core:reflect/iterator.odin
Jeroen van Rijn 11 months ago
parent
commit
4cf1af3f7d
1 changed files with 6 additions and 1 deletions
  1. 6 1
      core/reflect/iterator.odin

+ 6 - 1
core/reflect/iterator.odin

@@ -19,6 +19,7 @@ iterate_array :: proc(val: any, it: ^int) -> (elem: any, index: int, ok: bool) {
 			elem.data = rawptr(uintptr(val.data) + uintptr(it^ * info.elem_size))
 			elem.id = info.elem.id
 			ok = true
+			index = it^
 			it^ += 1
 		}
 	case Type_Info_Slice:
@@ -27,6 +28,7 @@ iterate_array :: proc(val: any, it: ^int) -> (elem: any, index: int, ok: bool) {
 			elem.data = rawptr(uintptr(array.data) + uintptr(it^ * info.elem_size))
 			elem.id = info.elem.id
 			ok = true
+			index = it^
 			it^ += 1
 		}
 	case Type_Info_Dynamic_Array:
@@ -35,6 +37,7 @@ iterate_array :: proc(val: any, it: ^int) -> (elem: any, index: int, ok: bool) {
 			elem.data = rawptr(uintptr(array.data) + uintptr(it^ * info.elem_size))
 			elem.id = info.elem.id
 			ok = true
+			index = it^
 			it^ += 1
 		}
 	}
@@ -69,10 +72,12 @@ iterate_map :: proc(val: any, it: ^int) -> (key, value: any, ok: bool) {
 				key.id     = info.key.id
 				value.id   = info.value.id
 				ok = true
+				it^ += 1
 				break
 			}
 
 		}
 	}
 	return
-}
+}
+