mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 11:31:20 -05:00
better output when trying to force a pure statment to become a return
This commit is contained in:
@@ -238,6 +238,9 @@ exports.LiteralNode = class LiteralNode extends BaseNode
|
||||
|
||||
constructor: (@value) ->
|
||||
|
||||
makeReturn: ->
|
||||
if @isStatement() then this else super()
|
||||
|
||||
# Break and continue must be treated as pure statements -- they lose their
|
||||
# meaning when wrapped in a closure.
|
||||
isStatement: ->
|
||||
@@ -258,10 +261,10 @@ exports.LiteralNode = class LiteralNode extends BaseNode
|
||||
# make sense.
|
||||
exports.ReturnNode = class ReturnNode extends BaseNode
|
||||
|
||||
class: 'ReturnNode'
|
||||
isStatement: -> yes
|
||||
class: 'ReturnNode'
|
||||
isStatement: -> yes
|
||||
isPureStatement: -> yes
|
||||
children: ['expression']
|
||||
children: ['expression']
|
||||
|
||||
constructor: (@expression) ->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user