Fix vector/_replacefirst

This changes the function to throw `:ignore-instruction` if the replacement value is not present in the vector.
This commit is contained in:
Erik Rauer 2021-01-03 18:31:12 -06:00
parent bcddca184c
commit d5f115f81c

@ -183,7 +183,10 @@
(let [lit-stack (get-vector-literal-type stack)]
(make-instruction state
(fn [lit1 lit2 vect]
(assoc vect (utils/indexof lit1 vect) lit2))
(let [replaceindex (utils/indexof lit1 vect)]
(if (= replaceindex -1)
:ignore-instruction
(assoc vect replaceindex lit2))))
[lit-stack lit-stack stack]
stack))))