risc is GREEN

totally, man.
Small fix in method missing fixed last block tests
(why, i do not know)
This commit is contained in:
2020-03-22 15:58:19 +02:00
parent 37feba1239
commit 90935bfbbc
5 changed files with 21 additions and 27 deletions

View File

@ -1,19 +1,18 @@
module SlotMachine
class MethodMissing < Macro
attr_reader :name
attr_reader :name_reg
def initialize( source , name )
def initialize( source , name_reg )
super(source)
name = name.value if name.is_a?(Sol::SymbolConstant)
raise "No reg #{name.class}" unless name.class == Symbol
@name = name
name_reg = Risc::RegisterValue.new(name_reg , :Word) if name_reg.class == Symbol
raise "No reg #{name_reg.class}" unless name_reg.is_a? Risc::RegisterValue
@name_reg = name_reg
end
def to_risc(compiler)
builder = compiler.builder(compiler.source_name)
from = compiler.load_object(Parfait.new_word_max(@name))
to = Risc::RegisterValue.new(:r1 , :Word)
builder.add_code Risc::Transfer.new(self , from , to)
builder.add_code Risc::Transfer.new(self , name_reg , to)
builder.add_code Risc::Syscall.new(self, :died )
return compiler
end