Browse Source

Support optional length parameter on struct tags for multi-pointers

gingerBill 3 years ago
parent
commit
c166b6a21d
1 changed files with 5 additions and 0 deletions
  1. 5 0
      core/fmt/fmt.odin

+ 5 - 0
core/fmt/fmt.odin

@@ -1709,6 +1709,11 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
 
 			elem := runtime.type_info_base(info.elem)
 			if elem != nil {
+				if n, ok := fi.optional_len.?; ok {
+					fmt_array(fi, ptr, n, elem.size, elem, verb)
+					return
+				}
+
 				#partial switch e in elem.variant {
 				case runtime.Type_Info_Array,
 				     runtime.Type_Info_Slice,