[parenscript-devel] Bug: inconsistent gensym suffixes on what ought to be the same loop control variable
Daniel Gackle
danielgackle at gmail.com
Fri Sep 14 05:32:17 UTC 2012
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20120913/b8cf3467/attachment.html>
More information about the parenscript-devel
mailing list