fix vool method updating
a start, should do code too
This commit is contained in:
parent
e90597c332
commit
315be69851
@ -18,11 +18,11 @@ body
|
|||||||
margin-left: 1%
|
margin-left: 1%
|
||||||
|
|
||||||
.vool_view
|
.vool_view
|
||||||
width: 18%
|
width: 14%
|
||||||
margin-left: 1%
|
margin-left: 1%
|
||||||
|
|
||||||
.mom_view
|
.mom_view
|
||||||
width: 20%
|
width: 24%
|
||||||
margin-left: 1%
|
margin-left: 1%
|
||||||
|
|
||||||
.risc_view
|
.risc_view
|
||||||
|
@ -17,45 +17,31 @@ class VoolView < ElementView
|
|||||||
def instruction_changed
|
def instruction_changed
|
||||||
i = @interpreter.instruction
|
i = @interpreter.instruction
|
||||||
return "" unless i
|
return "" unless i
|
||||||
update_method
|
|
||||||
case i.source
|
|
||||||
when Mom::Instruction
|
|
||||||
@ticker.text = i.source.class.name
|
|
||||||
# if e = @text.at_css("#i#{id}")
|
|
||||||
# if (old = @text.at_css(".fade_in"))
|
|
||||||
# old.remove_class("fade_in")
|
|
||||||
# end
|
|
||||||
# e.add_class "fade_in"
|
|
||||||
# end
|
|
||||||
when String
|
|
||||||
@ticker.text = i.source
|
|
||||||
when Risc::Instruction
|
|
||||||
@ticker.text = i.source.to_s
|
|
||||||
else
|
|
||||||
raise "Unrecognized source #{i.source.class.name} for #{i}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def update_method
|
|
||||||
i = @interpreter.instruction
|
|
||||||
if i.is_a?(Risc::FunctionReturn)
|
if i.is_a?(Risc::FunctionReturn)
|
||||||
link = @interpreter.get_register( i.register )
|
link = @interpreter.get_register( i.register )
|
||||||
#puts "Link #{link}"
|
puts "Link #{link}:#{link.source}"
|
||||||
raise "No link method" unless link
|
raise "No link method" unless link
|
||||||
i = link
|
i = link
|
||||||
end
|
end
|
||||||
return unless (i.is_a? Risc::Label)
|
method = nil
|
||||||
return unless i.is_method
|
case i.source
|
||||||
puts i.name
|
when Mom::Instruction
|
||||||
return
|
if(i.source.is_a?(Mom::SimpleCall))
|
||||||
cl_t_name , method_name = *i.name.split(".")
|
method = i.source.method
|
||||||
class_name = cl_t_name.split(" ").last.split("_").first
|
end
|
||||||
clazz = Parfait.object_space.get_class_by_name class_name
|
#TODO, give mom a source
|
||||||
raise "No class for #{cl_name} , #{i.name}" unless clazz
|
when Parfait::TypedMethod
|
||||||
type = clazz.instance_type
|
method = i.source
|
||||||
method = type.get_method( method_name )
|
when String
|
||||||
@element.at_css(".source").text = i.name
|
return
|
||||||
@text.inner_html = HtmlConverter.new.process( method.source )
|
else
|
||||||
|
raise "Unrecognized source #{i.source.class.name} for #{i}"
|
||||||
|
end
|
||||||
|
update_method(method) if method
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_method(method)
|
||||||
|
@text.inner_html = method.name
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user