From cae99f217cd08561cb5a2755c50ca13fe82368f7 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Tue, 7 Oct 2014 12:23:08 +0300 Subject: [PATCH] just make sre we really ret registers (some constants were flying about) --- lib/register/instruction.rb | 5 +++++ lib/register/instructions/register_transfer.rb | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/register/instruction.rb b/lib/register/instruction.rb index e1ca77a6..6bfdbc1a 100644 --- a/lib/register/instruction.rb +++ b/lib/register/instruction.rb @@ -26,6 +26,11 @@ module Register raise "abstract called for #{self.class}" end + # wrap symbols into regsiter reference if needed + def wrap_register reg + return reg if reg.is_a? RegisterReference + RegisterReference.new(reg) + end end end diff --git a/lib/register/instructions/register_transfer.rb b/lib/register/instructions/register_transfer.rb index e55386d2..44d4f59b 100644 --- a/lib/register/instructions/register_transfer.rb +++ b/lib/register/instructions/register_transfer.rb @@ -4,8 +4,8 @@ module Register class RegisterTransfer < Instruction def initialize from , to - @from = from - @to = to + @from = wrap_register(from) + @to = wrap_register(to) end attr_reader :from, :to end