mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
nodes: added missing jump-guard in While::makeReturn, fixing #1850
This commit is contained in:
parent
9633816d7a
commit
5bf8b422f8
3 changed files with 11 additions and 2 deletions
|
@ -1654,7 +1654,9 @@
|
|||
if (res) {
|
||||
return While.__super__.makeReturn.apply(this, arguments);
|
||||
} else {
|
||||
this.returns = true;
|
||||
this.returns = !this.jumps({
|
||||
loop: true
|
||||
});
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1232,7 +1232,7 @@ exports.While = class While extends Base
|
|||
if res
|
||||
super
|
||||
else
|
||||
@returns = yes
|
||||
@returns = not @jumps loop: yes
|
||||
this
|
||||
|
||||
addBody: (@body) ->
|
||||
|
|
|
@ -453,3 +453,10 @@ test "#1669: break/continue should skip the result only for that branch", ->
|
|||
continue unless n % 5
|
||||
n
|
||||
eq "#{ns}", "1,,3,,,7,,9"
|
||||
|
||||
test "#1850: inner `for` should not be expression-ized if `return`ing", ->
|
||||
eq '3,4,5', do ->
|
||||
for a in [1..9] then \
|
||||
for b in [1..9]
|
||||
c = Math.sqrt a*a + b*b
|
||||
return String [a, b, c] unless c % 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue