2018-07-19 13:46:51 +02:00
|
|
|
module Ruby
|
|
|
|
class ReturnStatement < Statement
|
|
|
|
include Normalizer
|
|
|
|
|
|
|
|
attr_reader :return_value
|
|
|
|
|
|
|
|
def initialize(value)
|
|
|
|
@return_value = value
|
|
|
|
end
|
|
|
|
|
2018-07-19 13:59:10 +02:00
|
|
|
def to_vool
|
2018-07-19 13:46:51 +02:00
|
|
|
val , rest = *normalize_name(@return_value)
|
2018-07-20 19:05:32 +02:00
|
|
|
me = Vool::ReturnStatement.new(val.to_vool)
|
2018-07-19 13:46:51 +02:00
|
|
|
return me unless rest
|
2018-07-20 19:05:32 +02:00
|
|
|
Vool::Statements.new([ rest.to_vool , me])
|
2018-07-19 13:46:51 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_s(depth = 0)
|
|
|
|
at_depth(depth , "return #{@return_value.to_s}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|