Changeset: Make sure `opOut` is cleared

`slicerZipperFunc()` previously assumed the provided `opOut` argument
was a null Op. Enforce this by clearing it at the beginning.
pull/5268/head
Richard Hansen 2021-10-02 18:05:24 -04:00
parent 18a6b7279c
commit 02ef78e174
1 changed files with 2 additions and 0 deletions

View File

@ -1179,6 +1179,7 @@ exports.composeAttributes = (att1, att2, resultIsMutation, pool) => {
* @param {AttributePool} pool - Can be null if definitely not needed.
*/
const slicerZipperFunc = (attOp, csOp, opOut, pool) => {
clearOp(opOut);
if (attOp.opcode === '-') {
copyOp(attOp, opOut);
attOp.opcode = '';
@ -2221,6 +2222,7 @@ exports.follow = (cs1, cs2, reverseInsertOrder, pool) => {
const hasInsertFirst = exports.attributeTester(['insertorder', 'first'], pool);
const newOps = applyZip(unpacked1.ops, unpacked2.ops, (op1, op2, opOut) => {
clearOp(opOut);
if (op1.opcode === '+' || op2.opcode === '+') {
let whichToDo;
if (op2.opcode !== '+') {