2017-01-14 18:28:44 +01:00
|
|
|
module Vm
|
2016-12-09 12:20:48 +01:00
|
|
|
module Tree
|
2017-01-15 12:01:28 +01:00
|
|
|
|
2016-12-09 12:20:48 +01:00
|
|
|
class Assignment < Statement
|
|
|
|
attr_accessor :name , :value
|
2017-01-15 12:01:28 +01:00
|
|
|
|
|
|
|
def initialize(name , value = nil )
|
|
|
|
@name , @value = name , value
|
2016-12-09 12:20:48 +01:00
|
|
|
end
|
2017-01-15 12:01:28 +01:00
|
|
|
|
2016-12-28 13:11:05 +01:00
|
|
|
def to_s
|
|
|
|
"#{name} = #{value}\n"
|
|
|
|
end
|
2017-01-15 12:01:28 +01:00
|
|
|
|
2016-12-08 18:38:50 +01:00
|
|
|
end
|
2017-01-15 12:01:28 +01:00
|
|
|
|
|
|
|
class IvarAssignment < Assignment
|
|
|
|
def to_s
|
|
|
|
"@#{name} = #{value}\n"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class ArgAssignment < Assignment
|
|
|
|
end
|
|
|
|
|
|
|
|
class LocalAssignment < Assignment
|
|
|
|
end
|
|
|
|
|
2016-12-08 18:38:50 +01:00
|
|
|
end
|
|
|
|
end
|