start simple with code listner

This commit is contained in:
Torsten Ruger
2018-06-02 16:34:44 +03:00
parent aa6707337a
commit 91c7903848
4 changed files with 51 additions and 8 deletions

View File

@ -8,7 +8,7 @@ module Risc
# At the end of the list the propagation spills into the next methods
# binary and so on
#
class CodePosition < ObjectPosition
class CodeListener
attr_reader :code , :method
@ -61,6 +61,18 @@ module Risc
return nekst if nekst.methods
return next_type(nekst)
end
def self.init( code , at = -1)
while code
position = ObjectPosition.new(code , at)
Position.set_to(position , at)
if code.next
listener = ObjectListener.new(code.next)
position.register_event(:position_changed , listener)
end
at += code.padded_length unless at < 0
code = code.next
end
end
end
end
end

View File

@ -74,4 +74,4 @@ end
require_relative "object_position"
require_relative "object_listener"
require_relative "instruction_position"
require_relative "code_position"
require_relative "code_listener"