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