rubyx/lib/ruby/return_statement.rb
Torsten Rüger 7c91a08d5b Fix vool assignments after call rework
also small fix for if and return, as they need to execute sneds and yields (not just sends), so testing for Call not SendStatement
2019-08-16 20:39:08 +03:00

23 lines
459 B
Ruby

module Ruby
class ReturnStatement < Statement
include Normalizer
attr_reader :return_value
def initialize(value)
@return_value = value
end
def to_vool
val , hoisted = *normalized_vool(@return_value)
me = Vool::ReturnStatement.new(val)
return me unless hoisted
Vool::Statements.new( hoisted ) << me
end
def to_s(depth = 0)
at_depth(depth , "return #{@return_value.to_s}")
end
end
end