first interpreted instruction, with gui change

This commit is contained in:
Torsten Ruger 2015-07-24 10:15:58 +03:00
parent 246bb5ee4f
commit f5ece67233
3 changed files with 14 additions and 8 deletions

View File

@ -6,21 +6,26 @@ class BlockView
include React::Component include React::Component
required_param :interpreter required_param :interpreter
define_state :block
before_mount do before_mount do
interpreter.register_event(event: :block_changed, listener: self, callback: :block_changed) interpreter.register_event(:block_changed, self)
block! interpreter.block
end end
def block_changed block def block_changed old , bl
block! block block! bl
end end
def render def render
return unless block
div.row do div.row do
div.col_md_5 do div.col_md_5 do
SourceView :source => interpreter.block.codes.first.source SourceView :source => block.codes.first.source
end end
div.col_md_5 do div.col_md_5 do
interpreter.block.codes.each do |code| h6 { "Block: #{block.name}"}
block.codes.each do |code|
code.to_s.br code.to_s.br
end end
end end

View File

@ -6,8 +6,8 @@ class SourceView
def render def render
div.row do div.row do
"Virtual Machine Instruction".span "Virtual Machine Instruction".br
source source.class.name
end end
end end

View File

@ -36,7 +36,8 @@ class Interpreter
end end
def execute_Branch def execute_Branch
target = @instruction.to target = @instruction.block
set_block target set_block target
false
end end
end end