Torsten
8867d60c13
logic is still wrong, even it is slightly less (at least loading the method name)
22 lines
622 B
Ruby
22 lines
622 B
Ruby
module SlotMachine
|
|
class MethodMissing < Macro
|
|
attr_reader :name
|
|
|
|
def initialize( source , name )
|
|
super(source)
|
|
name = name.value if name.is_a?(Sol::SymbolConstant)
|
|
raise "No reg #{name.class}" unless name.class == Symbol
|
|
@name = name
|
|
end
|
|
|
|
def to_risc(compiler)
|
|
builder = compiler.builder(compiler.source_name)
|
|
from = compiler.load_object(Parfait.new_word(@name))
|
|
to = Risc::RegisterValue.new(:r1 , :Word)
|
|
builder.add_code Risc::Transfer.new(self , from , to)
|
|
builder.add_code Risc::Syscall.new(self, :died )
|
|
return compiler
|
|
end
|
|
end
|
|
end
|