mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
fixed a bug where while
condition was compiling as statement
This commit is contained in:
parent
e89d7a7756
commit
9c55bd59a1
3 changed files with 6 additions and 2 deletions
|
@ -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');
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue