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
required_param :interpreter
define_state :block
before_mount do
interpreter.register_event(event: :block_changed, listener: self, callback: :block_changed)
interpreter.register_event(:block_changed, self)
block! interpreter.block
end
def block_changed block
block! block
def block_changed old , bl
block! bl
end
def render
return unless block
div.row do
div.col_md_5 do
SourceView :source => interpreter.block.codes.first.source
SourceView :source => block.codes.first.source
end
div.col_md_5 do
interpreter.block.codes.each do |code|
h6 { "Block: #{block.name}"}
block.codes.each do |code|
code.to_s.br
end
end

View File

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

View File

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