2017-04-01 21:28:57 +03:00
|
|
|
module Vool
|
2017-04-12 20:29:45 +03:00
|
|
|
|
2017-04-01 21:28:57 +03:00
|
|
|
class Assignment < Statement
|
2017-04-06 16:06:51 +03:00
|
|
|
attr_reader :name , :value
|
2017-04-02 12:59:07 +03:00
|
|
|
def initialize(name , value )
|
|
|
|
@name , @value = name , value
|
2017-04-01 21:28:57 +03:00
|
|
|
end
|
2018-03-15 11:24:14 +05:30
|
|
|
|
2018-03-15 20:33:38 +05:30
|
|
|
def each(&block)
|
|
|
|
block.call(self)
|
|
|
|
@value.each(&block)
|
2017-04-08 12:10:42 +03:00
|
|
|
end
|
2018-07-03 22:18:19 +03:00
|
|
|
|
|
|
|
def to_s(depth = 0)
|
|
|
|
at_depth(depth , "#{@name} = #{@value}")
|
|
|
|
end
|
|
|
|
|
2018-07-20 20:06:14 +03:00
|
|
|
def chain_assign(assign , compiler)
|
2018-07-30 20:11:52 +03:00
|
|
|
return assign unless @value.is_a?(CallStatement)
|
2018-07-20 20:06:14 +03:00
|
|
|
@value.to_mom(compiler) << assign
|
|
|
|
end
|
2017-04-01 21:28:57 +03:00
|
|
|
end
|
|
|
|
end
|