diff --git a/lib/arm/translator.rb b/lib/arm/translator.rb index a558738e..fee503c9 100644 --- a/lib/arm/translator.rb +++ b/lib/arm/translator.rb @@ -65,9 +65,10 @@ module Arm ArmMachine.b( code.method.binary ) end - def translate_FunctionReturn code + def translate_FunctionReturn( code ) ArmMachine.mov( :pc , code.register) end + alias :translate_DynamicJump :translate_FunctionReturn def translate_LoadConstant( code ) constant = code.constant diff --git a/test/arm/test_translator.rb b/test/arm/test_translator.rb new file mode 100644 index 00000000..cd5914c5 --- /dev/null +++ b/test/arm/test_translator.rb @@ -0,0 +1,17 @@ +require_relative 'helper' + +module Arm + class TestStack < MiniTest::Test + + def test_init + assert Translator.new + end + + def test_dynamic + trans = Translator.new + jump = Risc::DynamicJump.new("" , :r1) + res = trans.translate jump + assert :r1 , res.from + end + end +end