remove dead code
leave circle detection for now
This commit is contained in:
parent
88dbc7c84f
commit
fe71ddc5ae
@ -10,16 +10,6 @@ module Util
|
|||||||
nekst
|
nekst
|
||||||
end
|
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 )
|
# get the next instruction (without arg given )
|
||||||
# when given an interger, advance along the line that many time and return.
|
# when given an interger, advance along the line that many time and return.
|
||||||
def next( amount = 1)
|
def next( amount = 1)
|
||||||
@ -38,7 +28,11 @@ module Util
|
|||||||
# return last set instruction. ie follow the linked list until it stops
|
# return last set instruction. ie follow the linked list until it stops
|
||||||
def last
|
def last
|
||||||
code = self
|
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
|
return code
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,13 +54,6 @@ module Risc
|
|||||||
assert_equal @label , @instruction.next
|
assert_equal @label , @instruction.next
|
||||||
assert_nil @instruction.next(2)
|
assert_nil @instruction.next(2)
|
||||||
end
|
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
|
def test_label_is_method
|
||||||
label = Label.new("test" , "Object.test")
|
label = Label.new("test" , "Object.test")
|
||||||
assert label.is_method
|
assert label.is_method
|
||||||
|
Loading…
Reference in New Issue
Block a user