integrating the sources to views
This commit is contained in:
parent
e460e0041b
commit
7e34ae003e
@ -18,7 +18,7 @@ class BlockView
|
||||
def update_block
|
||||
block_name! interpreter.block.name
|
||||
codes = interpreter.block.codes.dup
|
||||
slice = codes.index(interpreter.instruction) - 1
|
||||
slice = codes.index(interpreter.instruction) #- 1
|
||||
codes.shift( slice ) if slice >= 0
|
||||
codes.pop while(codes.length > 4)
|
||||
block! codes
|
||||
|
@ -2,13 +2,30 @@ class SourceView
|
||||
|
||||
include React::Component
|
||||
|
||||
required_param :source, type: Virtual::Instruction
|
||||
required_param :source
|
||||
|
||||
define_state :sources => []
|
||||
|
||||
before_update do
|
||||
text = source_text(source)
|
||||
return if sources.last == text
|
||||
sources << text
|
||||
sources.shift if sources.length > 5
|
||||
end
|
||||
def render
|
||||
div.row do
|
||||
"Virtual Machine Instruction".br
|
||||
source.class.name
|
||||
sources.each do |s|
|
||||
s.br
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def source_text
|
||||
if source.is_a? Virtual::Instruction
|
||||
return source.class.name
|
||||
else
|
||||
return "Method: #{source.name}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user