The decision on which is moving up to the ruby compiler, so it can at the same time emit the correct assignment form. Just another example of moving away from a language and to an intermediate form (that has no language equivalent)
31 lines
460 B
Ruby
31 lines
460 B
Ruby
module Vm
|
|
module Tree
|
|
|
|
class Assignment < Statement
|
|
attr_accessor :name , :value
|
|
|
|
def initialize(name , value = nil )
|
|
@name , @value = name , value
|
|
end
|
|
|
|
def to_s
|
|
"#{name} = #{value}\n"
|
|
end
|
|
|
|
end
|
|
|
|
class IvarAssignment < Assignment
|
|
def to_s
|
|
"@#{name} = #{value}\n"
|
|
end
|
|
end
|
|
|
|
class ArgAssignment < Assignment
|
|
end
|
|
|
|
class LocalAssignment < Assignment
|
|
end
|
|
|
|
end
|
|
end
|