fix array handling code

This commit is contained in:
Kristin Rutenkolk 2024-10-28 21:28:50 +01:00
parent 43acc60784
commit 8844eef320

View file

@ -1650,20 +1650,19 @@
(let [outer-code `(let [arr# (~(coffitype->array-fn (second _type)) ~(second (rest _type)))] arr# ) (let [outer-code `(let [arr# (~(coffitype->array-fn (second _type)) ~(second (rest _type)))] arr# )
gen-arr (nth outer-code 2)] gen-arr (nth outer-code 2)]
[(concat (butlast outer-code) [(concat (butlast outer-code)
(list (map
(concat [`aset gen-arr] (fn [index]
(reduce (let [deserialize-instructions
concat (generate-deserialize
(map (second _type)
(fn [index] (+ offset (* (size-of (second _type)) index)))]
(let [deserialize-instructions (list `aset gen-arr index (first deserialize-instructions))
(generate-deserialize #_(if true #_(vector? deserialize-instructions)
(second _type) (list index (first deserialize-instructions))
(+ offset (* (size-of (second _type)) index)))] (list index deserialize-instructions))
(if (vector? deserialize-instructions)
(list index (first deserialize-instructions)) ))
(list index deserialize-instructions)))) (range (second (rest _type))))
(range (second (rest _type)))))))
[gen-arr])])) [gen-arr])]))
(defn typelist [typename fields] (defn typelist [typename fields]