Fix vector/_set

This makes it so that `vector/_set` returns `:ignore-instruction` if the given vector is empty.
This commit is contained in:
Erik Rauer 2021-01-05 15:47:37 -06:00
parent 2ffffa9fd4
commit 7613f18c70

View File

@ -211,8 +211,10 @@
(let [lit-stack (get-vector-literal-type stack)]
(make-instruction state
(fn [lit n vect]
(assoc vect (mod n (count vect)) lit))
[:integer lit-stack stack]
(if (empty? vect)
:ignore-instruction
(assoc vect (mod n (count vect)) lit)))
[lit-stack :integer stack]
stack))))
;; Pushes a subvector of the top item, with start and end indices determined by