implements fetching of next instruction
This commit is contained in:
parent
5d42da9d03
commit
959cb628fa
@ -50,9 +50,17 @@ class Interpreter
|
|||||||
name = @instruction.class.name.split("::").last
|
name = @instruction.class.name.split("::").last
|
||||||
fetch = send "execute_#{name}"
|
fetch = send "execute_#{name}"
|
||||||
return unless fetch
|
return unless fetch
|
||||||
get_next_intruction
|
fetch_next_intruction
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fetch_next_intruction
|
||||||
|
if(@instruction != @block.codes.last)
|
||||||
|
set_instruction @block.codes[ @block.codes.index(@instruction) + 1]
|
||||||
|
else
|
||||||
|
next_b = @block.method.source.blocks.index(@block) + 1
|
||||||
|
set_block @block.method.source.blocks[next_b]
|
||||||
|
end
|
||||||
|
end
|
||||||
def execute_Branch
|
def execute_Branch
|
||||||
target = @instruction.block
|
target = @instruction.block
|
||||||
set_block target
|
set_block target
|
||||||
|
Loading…
Reference in New Issue
Block a user