mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
allowing implicit returns to be pushed down into each branch of computation, even when there's an explicit return nested more deeply. Issue #401
This commit is contained in:
@@ -179,7 +179,7 @@ exports.Expressions: class Expressions extends BaseNode
|
||||
last: @expressions[idx]
|
||||
last: @expressions[idx: - 1] if last instanceof CommentNode
|
||||
return this if not last or last instanceof ReturnNode
|
||||
@expressions[idx]: last.makeReturn() unless last.containsPureStatement()
|
||||
@expressions[idx]: last.makeReturn()
|
||||
this
|
||||
|
||||
# An **Expressions** is the only node that can serve as the root.
|
||||
@@ -264,6 +264,9 @@ exports.ReturnNode: class ReturnNode extends BaseNode
|
||||
topSensitive: ->
|
||||
true
|
||||
|
||||
makeReturn: ->
|
||||
this
|
||||
|
||||
compileNode: (o) ->
|
||||
expr: @expression.makeReturn()
|
||||
return expr.compile(o) unless expr instanceof ReturnNode
|
||||
|
||||
Reference in New Issue
Block a user