Browse Source

Add introspection feature to allow array subsets

This assumes your code knows to check for empty slots, e.g. if they
are zero-initialized.
master
Macoy Madson 5 months ago
parent
commit
835091b256
  1. 6
      src/Introspection.cake

6
src/Introspection.cake

@ -1288,7 +1288,11 @@
(addr value-argument-end))
;; (print-string-range value-argument-start value-argument-end true)
(unless (and value-argument-start value-argument-end)
(fprintf stderr "error: field %s expected %d elements but found only %d\n"
(when (metadata-field-has-tag current-field "'array-allow-subset")
(set state state-read-member-name)
;; introspect-field-dispatch is a loop for all fields
(break))
(fprintf stderr "error: field %s expected %d elements but found only %d. Add 'array-allow-subset to allow this.\n"
(path current-field > name) (type-cast (path current-field > count) int)
dispatch-value-index)
(return false))))

Loading…
Cancel
Save