diff --git a/lib/risc/interpreter.rb b/lib/risc/interpreter.rb index 155e998c..3d0a9786 100644 --- a/lib/risc/interpreter.rb +++ b/lib/risc/interpreter.rb @@ -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 diff --git a/test/risc/interpreter/assign/test_assign_local.rb b/test/risc/interpreter/assign/test_assign_local.rb index 7ebe6897..c6f3fd90 100644 --- a/test/risc/interpreter/assign/test_assign_local.rb +++ b/test/risc/interpreter/assign/test_assign_local.rb @@ -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) diff --git a/test/risc/interpreter/calling/test_div10.rb b/test/risc/interpreter/calling/test_div10.rb index 3adfb1b2..b09be31e 100644 --- a/test/risc/interpreter/calling/test_div10.rb +++ b/test/risc/interpreter/calling/test_div10.rb @@ -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) diff --git a/test/risc/interpreter/test_dynamic_call.rb b/test/risc/interpreter/test_dynamic_call.rb index 6a1f9856..1d0ca043 100644 --- a/test/risc/interpreter/test_dynamic_call.rb +++ b/test/risc/interpreter/test_dynamic_call.rb @@ -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) diff --git a/test/risc/interpreter/test_return.rb b/test/risc/interpreter/test_return.rb index 30a377a3..48579ccd 100644 --- a/test/risc/interpreter/test_return.rb +++ b/test/risc/interpreter/test_return.rb @@ -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)