remove dead code

leave circle detection for now
This commit is contained in:
Torsten Ruger 2018-04-06 20:20:39 +03:00
parent 88dbc7c84f
commit fe71ddc5ae
2 changed files with 5 additions and 18 deletions

View File

@ -10,16 +10,6 @@ module Util
nekst
end
# during translation we replace one by one
# TODO avoid this by building a new list
# Make arm instruction not derive from risc (which is weird anyway)
# and include the List into it, translate in same way we go from mom->risc
def replace_next( nekst )
old = @next
@next = nekst
@next.append old.next if old
end
# get the next instruction (without arg given )
# when given an interger, advance along the line that many time and return.
def next( amount = 1)
@ -38,7 +28,11 @@ module Util
# return last set instruction. ie follow the linked list until it stops
def last
code = self
code = code.next while( code.next )
while( code.next )
puts "code #{code.class} #{code}"
raise "UUPS #{code.class}:#{code}" if code == code.next
code = code.next
end
return code
end

View File

@ -54,13 +54,6 @@ module Risc
assert_equal @label , @instruction.next
assert_nil @instruction.next(2)
end
def test_replace
@instruction.append @branch
@instruction.replace_next @label
assert_equal @label, @instruction.last
assert_equal @label, @instruction.next
assert_equal 2 , @instruction.length , @instruction.to_arr
end
def test_label_is_method
label = Label.new("test" , "Object.test")
assert label.is_method