only let returns stop an expression from being closure-ified -- breaks and continues may be valid

This commit is contained in:
Jeremy Ashkenas
2010-01-17 10:21:24 -05:00
parent f6c8e81ea6
commit d7d9cb8d28

View File

@@ -45,7 +45,7 @@ module CoffeeScript
@indent = o[:indent]
top = self.top_sensitive? ? @options[:top] : @options.delete(:top)
closure = statement? && !statement_only? && !top && !@options[:return] && !self.is_a?(CommentNode)
closure &&= !contains? {|n| n.statement_only? }
closure &&= !contains? {|n| n.is_a?(ReturnNode) }
closure ? compile_closure(@options) : compile_node(@options)
end