Fixing self type creation

When compiling a classs, we pick up all instance variables.
Now that conditions and returns can be calls, that was broken, now fixed
This commit is contained in:
2019-08-17 15:58:27 +03:00
parent d3f3c91ae5
commit ae7f31381b
6 changed files with 165 additions and 18 deletions

View File

@ -7,19 +7,19 @@ module Risc
def setup
super
@input = "return @a.div4"
@expect = [LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg, #5
OperatorInstruction, IsZero, SlotToReg, SlotToReg, SlotToReg, #10
LoadConstant, RegToSlot, LoadConstant, LoadConstant, SlotToReg, #15
SlotToReg, Label, LoadConstant, OperatorInstruction, IsZero, #20
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch, #25
Label, LoadConstant, SlotToReg, Transfer, Syscall, #30
Transfer, Transfer, SlotToReg, RegToSlot, Label, #35
RegToSlot, Label, LoadConstant, SlotToReg, LoadConstant, #40
SlotToReg, SlotToReg, RegToSlot, RegToSlot, RegToSlot, #45
RegToSlot, SlotToReg, SlotToReg, SlotToReg, RegToSlot, #50
LoadConstant, SlotToReg, RegToSlot, SlotToReg, LoadConstant, #55
SlotToReg, DynamicJump, Label, SlotToReg, SlotToReg, #60
RegToSlot, SlotToReg, SlotToReg, RegToSlot, Branch] #65
@expect = [LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg, #4
OperatorInstruction, IsZero, SlotToReg, SlotToReg, SlotToReg, #9
LoadConstant, RegToSlot, LoadConstant, LoadConstant, SlotToReg, #14
SlotToReg, Label, LoadConstant, OperatorInstruction, IsZero, #19
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch, #24
Label, LoadConstant, SlotToReg, Transfer, Syscall, #29
Transfer, Transfer, SlotToReg, RegToSlot, Label, #34
RegToSlot, Label, LoadConstant, SlotToReg, LoadConstant, #39
SlotToReg, SlotToReg, RegToSlot, RegToSlot, RegToSlot, #44
RegToSlot, SlotToReg, SlotToReg, SlotToReg, RegToSlot, #49
LoadConstant, SlotToReg, RegToSlot, SlotToReg, LoadConstant, #54
SlotToReg, DynamicJump, Label, SlotToReg, RegToSlot, #59
Branch] #64
end
def test_return_instructions
@ -27,7 +27,7 @@ module Risc
end
def test_function_return
produced = produce_body
assert_equal Branch , produced.next(64).class
assert_equal Branch , produced.next(60).class
end
def test_cache_check
produced = produce_body