fix helper

and start on arg test
This commit is contained in:
Torsten Ruger
2018-03-30 18:05:38 +03:00
parent 1956f18faa
commit e68b28d66d
5 changed files with 93 additions and 26 deletions

View File

@ -18,14 +18,14 @@ module Risc
def +( context )
source = "plus"
compiler = compiler_for(:Integer,:+ ,{other: :int})
me , other = self_and_int_arg(compiler,source)
me , other = self_and_int_arg(compiler,source + "1")
# reduce me and other to integers
compiler.add_slot_to_reg( source , me , 1 , me)
compiler.add_slot_to_reg( source , other , 1 , other)
compiler.add_code Risc.op( source , :+ , me , other)
compiler.add_slot_to_reg( source + "2" , me , 1 , me)
compiler.add_slot_to_reg( source + "3", other , 1 , other)
compiler.add_code Risc.op( source + "4", :+ , me , other)
#TODO must get an Integer and put the value there then return the integer (object not value)
# and put it back into the return value
compiler.add_reg_to_slot( source , me , :message , :return_value)
compiler.add_reg_to_slot( source + "5" , me , :message , :return_value)
return compiler.method
end