fixing explicit returns of comprehensions (and probably other things as well)

This commit is contained in:
Jeremy Ashkenas
2010-03-25 18:51:24 -04:00
parent ad93d2fe4d
commit ecd1c77f48
3 changed files with 21 additions and 3 deletions

View File

@@ -243,7 +243,13 @@ exports.ReturnNode: class ReturnNode extends BaseNode
constructor: (expression) ->
@children: [@expression: expression]
top_sensitive: ->
true
compile_node: (o) ->
expr: @expression.make_return()
return expr.compile(o) unless expr instanceof ReturnNode
del o, 'top'
o.as_statement: true if @expression.is_statement()
"${@tab}return ${@expression.compile(o)};"