adding register_names to instruction protocol
This commit is contained in:
@ -27,6 +27,13 @@ module Risc
|
||||
end
|
||||
attr_accessor :register , :array , :index
|
||||
|
||||
# return an array of names of registers that is used by the instruction
|
||||
def register_names
|
||||
names = [array.symbol , register.symbol]
|
||||
names << index.symbol if index.is_a?(RegisterValue)
|
||||
names
|
||||
end
|
||||
|
||||
def to_s
|
||||
class_source "#{register} -> #{array}[#{index}]"
|
||||
end
|
||||
|
Reference in New Issue
Block a user