diff --git a/lib/register/instructions/load_constant.rb b/lib/register/instructions/load_constant.rb index 4a40cae6..0c53add3 100644 --- a/lib/register/instructions/load_constant.rb +++ b/lib/register/instructions/load_constant.rb @@ -16,21 +16,21 @@ module Register "LoadConstant: #{register} <- #{constant_str}" end - def self.load source , constant , register - LoadConstant.new source , constant , register - end private def constant_str - case @constant - when String , Symbol , Fixnum , Integer - @constant.to_s + case @constant + when String , Symbol , Fixnum , Integer + @constant.to_s + else + if( @constant.respond_to? :sof_reference_name ) + constant.sof_reference_name else - if( @constant.respond_to? :sof_reference_name ) - constant.sof_reference_name - else - constant.class.name.to_s - end + constant.class.name.to_s end + end end end + def self.load_constant source , constant , register + LoadConstant.new source , constant , register + end end diff --git a/lib/register/instructions/operator_instruction.rb b/lib/register/instructions/operator_instruction.rb index e1508bfb..c404961a 100644 --- a/lib/register/instructions/operator_instruction.rb +++ b/lib/register/instructions/operator_instruction.rb @@ -13,9 +13,9 @@ module Register "OperatorInstruction: #{left} #{operator} #{right}" end - def self.op source , operator , left , right - OperatorInstruction.new source , operator , left , right - end + end + def self.op source , operator , left , right + OperatorInstruction.new source , operator , left , right end end diff --git a/lib/register/instructions/register_transfer.rb b/lib/register/instructions/register_transfer.rb index 6253fca4..ca9e9b1a 100644 --- a/lib/register/instructions/register_transfer.rb +++ b/lib/register/instructions/register_transfer.rb @@ -28,9 +28,8 @@ module Register def to_s "RegisterTransfer: #{from} -> #{to}" end - - def self.transfer source , from , to - RegisterTransfer.new source , from , to - end + end + def self.transfer source , from , to + RegisterTransfer.new source , from , to end end