module Ruby2JS::Filter::Return
Constants
- EXPRESSIONS
Public Instance Methods
on_block(node)
click to toggle source
Calls superclass method
# File lib/ruby2js/filter/return.rb, line 10 def on_block(node) node = super return node unless node.type == :block children = node.children.dup children[-1] = s(:nil) if children.last == nil node.updated nil, [*children[0..1], s(:autoreturn, *children[2..-1])] end
on_def(node)
click to toggle source
Calls superclass method
# File lib/ruby2js/filter/return.rb, line 21 def on_def(node) node = super return node unless node.type == :def or node.type == :deff return node if [:constructor, :initialize].include?(node.children.first) children = node.children[1..-1] children[-1] = s(:nil) if children.last == nil node.updated nil, [node.children[0], children.first, s(:autoreturn, *children[1..-1])] end
on_deff(node)
click to toggle source
# File lib/ruby2js/filter/return.rb, line 34 def on_deff(node) on_def(node) end
on_defs(node)
click to toggle source
Calls superclass method
# File lib/ruby2js/filter/return.rb, line 38 def on_defs(node) node = super return node unless node.type == :defs children = node.children[3..-1] children[-1] = s(:nil) if children.last == nil node.updated nil, [*node.children[0..2], s(:autoreturn, *children)] end