diff --git a/lib/nodes.js b/lib/nodes.js index 79442cce..cd6ba067 100644 --- a/lib/nodes.js +++ b/lib/nodes.js @@ -1294,9 +1294,9 @@ var cond, post, pre, rvar, set, top; top = del(o, 'top') && !this.returns; o.indent = this.idt(1); - o.top = true; this.condition.parenthetical = true; cond = this.condition.compile(o); + o.top = true; set = ''; if (!top) { rvar = o.scope.freeVariable('result'); diff --git a/src/nodes.coffee b/src/nodes.coffee index 31e17a56..90166415 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -1126,9 +1126,9 @@ exports.While = class While extends Base compileNode: (o) -> top = del(o, 'top') and not @returns o.indent = @idt 1 - o.top = true @condition.parenthetical = yes cond = @condition.compile(o) + o.top = true set = '' unless top rvar = o.scope.freeVariable 'result' diff --git a/test/test_while.coffee b/test/test_while.coffee index 593ab218..3e3a83f7 100644 --- a/test/test_while.coffee +++ b/test/test_while.coffee @@ -47,3 +47,7 @@ loop list.push i * 2 ok list.join(' ') is '8 6 4 2' + + +#759: `if` within `while` condition +2 while if 1 then 0