I just ran into a strange bug where the gensym'd suffixes on loop
control variables change to the wrong thing. The bug appears to be
triggered by a (RETURN) form inside a loop that has more than one
FOR clause. For each extra clause, the suffixes increase by one.
I haven't tried to track down the cause of the bug, but I did just push
a failing test (LOOP-PARALLEL-CLAUSES-WITH-RETURN) to
illustrate it.
(defun-js foo ()
(loop :for i :from 0 :below 10 :for x = (* i 10)
:when (> i 5) :do (return x)
:collect i))
=> (note added comments below):
function foo() {
return (function () {
var collect3170 = [];
var loopResultVarSet3171 = null;
var loopResultVar3172 = null;
for (var i = 0; i < 10; i += 1) {
var x3171 = i * 10;
if (i > 5) {
loopResultVarSet3172 = true; // <---- suffix should be 3171, not 3172
loopResultVar3173 = x3171; // <---- suffix should be 3172, not 3173
break;
};
collect3170.push(i);
};
if (loopResultVarSet3171) {
return loopResultVar3172;
};
return collect3170;
})();
};
Daniel