fix register shortcuts

This commit is contained in:
Torsten Ruger 2015-11-21 14:17:54 +02:00
parent 96972dab29
commit 91a0365c2e
3 changed files with 17 additions and 18 deletions

View File

@ -16,21 +16,21 @@ module Register
"LoadConstant: #{register} <- #{constant_str}" "LoadConstant: #{register} <- #{constant_str}"
end end
def self.load source , constant , register
LoadConstant.new source , constant , register
end
private private
def constant_str def constant_str
case @constant case @constant
when String , Symbol , Fixnum , Integer when String , Symbol , Fixnum , Integer
@constant.to_s @constant.to_s
else
if( @constant.respond_to? :sof_reference_name )
constant.sof_reference_name
else else
if( @constant.respond_to? :sof_reference_name ) constant.class.name.to_s
constant.sof_reference_name
else
constant.class.name.to_s
end
end end
end
end end
end end
def self.load_constant source , constant , register
LoadConstant.new source , constant , register
end
end end

View File

@ -13,9 +13,9 @@ module Register
"OperatorInstruction: #{left} #{operator} #{right}" "OperatorInstruction: #{left} #{operator} #{right}"
end end
def self.op source , operator , left , right end
OperatorInstruction.new source , operator , left , right def self.op source , operator , left , right
end OperatorInstruction.new source , operator , left , right
end end
end end

View File

@ -28,9 +28,8 @@ module Register
def to_s def to_s
"RegisterTransfer: #{from} -> #{to}" "RegisterTransfer: #{from} -> #{to}"
end end
end
def self.transfer source , from , to def self.transfer source , from , to
RegisterTransfer.new source , from , to RegisterTransfer.new source , from , to
end
end end
end end