using label int in interpreter

This commit is contained in:
Torsten Ruger 2018-05-30 11:49:29 +03:00
parent 0dc89c772a
commit 01a2911483
5 changed files with 6 additions and 6 deletions

View File

@ -141,7 +141,7 @@ module Risc
def execute_LoadConstant
to = @instruction.register
value = @instruction.constant
value = value.value if value.is_a?(Mom::Constant)
value = value.integer if value.is_a?(Label)
set_register( to , value )
true
end
@ -226,7 +226,7 @@ module Risc
def execute_FunctionReturn
link = get_register( @instruction.register )
log.debug "Return to #{link}"
set_pc Position.get(link).at
set_pc link.value
false
end

View File

@ -32,7 +32,7 @@ module Risc
ret = main_ticks(12)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal Label , link.class
assert_equal Parfait::Integer , link.class
end
def test_transfer
transfer = main_ticks(13)

View File

@ -42,7 +42,7 @@ module Risc
ret = main_ticks(74)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal Label , link.class
assert_equal Parfait::Integer , link.class
end
def test_sys
sys = main_ticks(89)

View File

@ -62,7 +62,7 @@ module Risc
ret = main_ticks(137)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal Label , link.class
assert_equal Parfait::Integer , link.class
end
def test_sys
sys = main_ticks(139)

View File

@ -31,7 +31,7 @@ module Risc
ret = main_ticks(8)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal Label , link.class
assert_equal Parfait::Integer , link.class
end
def test_transfer
transfer = main_ticks(9)