update return address in label

so return jumps go to the right address
This commit is contained in:
Torsten Ruger
2018-06-10 09:15:57 +03:00
parent c7ad1d98ca
commit 0513cd504f
3 changed files with 22 additions and 8 deletions

View File

@ -50,8 +50,11 @@ module Risc
raise "Invalid negative index #{@index} , #{Position.get(@binary)}" if index < 0
end
# update label positions. All else done in position_changing
def position_changed(position)
#code moved to position_changing
instruction = position.object
return unless instruction.is_a?(Label)
instruction.address.set_value(position.at)
end
# When this is called, only the actual insert has happened (keeping the