rubyx/lib/ruby/return_statement.rb
Torsten Rüger d1f8733623 Rename Vool to Sol
Simple is really the descriptive name for the layer
Sure, it is "virtual" but that is not as important as the fact that it is simple (or simplified)
Also objct (based really) is better, since orientated implies it is a little like that, but only orientated, not really it. Sol only has objects, nothing else
Just cause i was renaming anyway
2019-10-04 00:38:47 +03:00

23 lines
474 B
Ruby

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