mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
fixed a bug where while condition was compiling as statement
This commit is contained in:
@@ -1294,9 +1294,9 @@
|
|||||||
var cond, post, pre, rvar, set, top;
|
var cond, post, pre, rvar, set, top;
|
||||||
top = del(o, 'top') && !this.returns;
|
top = del(o, 'top') && !this.returns;
|
||||||
o.indent = this.idt(1);
|
o.indent = this.idt(1);
|
||||||
o.top = true;
|
|
||||||
this.condition.parenthetical = true;
|
this.condition.parenthetical = true;
|
||||||
cond = this.condition.compile(o);
|
cond = this.condition.compile(o);
|
||||||
|
o.top = true;
|
||||||
set = '';
|
set = '';
|
||||||
if (!top) {
|
if (!top) {
|
||||||
rvar = o.scope.freeVariable('result');
|
rvar = o.scope.freeVariable('result');
|
||||||
|
|||||||
@@ -1126,9 +1126,9 @@ exports.While = class While extends Base
|
|||||||
compileNode: (o) ->
|
compileNode: (o) ->
|
||||||
top = del(o, 'top') and not @returns
|
top = del(o, 'top') and not @returns
|
||||||
o.indent = @idt 1
|
o.indent = @idt 1
|
||||||
o.top = true
|
|
||||||
@condition.parenthetical = yes
|
@condition.parenthetical = yes
|
||||||
cond = @condition.compile(o)
|
cond = @condition.compile(o)
|
||||||
|
o.top = true
|
||||||
set = ''
|
set = ''
|
||||||
unless top
|
unless top
|
||||||
rvar = o.scope.freeVariable 'result'
|
rvar = o.scope.freeVariable 'result'
|
||||||
|
|||||||
@@ -47,3 +47,7 @@ loop
|
|||||||
list.push i * 2
|
list.push i * 2
|
||||||
|
|
||||||
ok list.join(' ') is '8 6 4 2'
|
ok list.join(' ') is '8 6 4 2'
|
||||||
|
|
||||||
|
|
||||||
|
#759: `if` within `while` condition
|
||||||
|
2 while if 1 then 0
|
||||||
|
|||||||
Reference in New Issue
Block a user