getting basics to work
This commit is contained in:
parent
0aafeeeb22
commit
cc6a050250
@ -39,7 +39,10 @@ class MainView < ListView
|
||||
|
||||
def initialize
|
||||
machine = Register.machine.boot
|
||||
code = s(:statements, s(:return, s(:operator_value, :+, s(:int, 5), s(:int, 7))))
|
||||
code = s(:statements, s(:call,
|
||||
s(:name, :set_internal_byte),
|
||||
s(:arguments, s(:int, 1), s(:int, 104)),
|
||||
s(:receiver, s(:string, "Hello"))))
|
||||
Typed.compile( code )
|
||||
machine.collect
|
||||
@interpreter = Register::Interpreter.new
|
||||
|
@ -29,6 +29,8 @@ class SourceView < ElementView
|
||||
end
|
||||
when String
|
||||
@ticker.text = i.source
|
||||
when Typed::Code
|
||||
@ticker.text = i.source.to_s
|
||||
else
|
||||
raise i.source.class.name
|
||||
end
|
||||
@ -45,14 +47,14 @@ class SourceView < ElementView
|
||||
i = link
|
||||
end
|
||||
return unless (i.is_a? Register::Label)
|
||||
if i.is_method
|
||||
cl_name , method_name = *i.name.split(".")
|
||||
clazz = Register.machine.space.get_class_by_name cl_name.split(" ").last
|
||||
raise "No class for #{cl_name} , #{i.name}" unless clazz
|
||||
method = clazz.get_instance_method( method_name)
|
||||
else
|
||||
return
|
||||
end
|
||||
return unless i.is_method
|
||||
puts i.name
|
||||
cl_t_name , method_name = *i.name.split(".")
|
||||
class_name = cl_t_name.split(" ").last.split("_").first
|
||||
clazz = Register.machine.space.get_class_by_name class_name
|
||||
raise "No class for #{cl_name} , #{i.name}" unless clazz
|
||||
type = clazz.instance_type
|
||||
method = type.get_instance_method( method_name )
|
||||
@element.at_css(".source").text = i.name
|
||||
@text.inner_html = HtmlConverter.new.process( method.source )
|
||||
end
|
||||
|
@ -28,7 +28,7 @@ class SelectView < ElementView
|
||||
end
|
||||
|
||||
def get_codes
|
||||
@codes = ["1", "2"]
|
||||
@codes = ["set_internal_byte"]
|
||||
add_selection
|
||||
end
|
||||
|
||||
@ -41,7 +41,7 @@ class SelectView < ElementView
|
||||
list << code
|
||||
end
|
||||
Promise.new.then{
|
||||
select(@codes.first)
|
||||
select(@codes.first)
|
||||
}
|
||||
@element.at_css(".code_list") << list
|
||||
end
|
||||
@ -49,7 +49,10 @@ class SelectView < ElementView
|
||||
def select code
|
||||
@interpreter.set_state :stopped
|
||||
@element.at_css(".selected").text = code
|
||||
input = s(:statements, s(:return, s(:operator_value, :+, s(:int, 5), s(:int, 7))))
|
||||
input = s(:statements, s(:call,
|
||||
s(:name, :set_internal_byte),
|
||||
s(:arguments, s(:int, 1), s(:int, 104)),
|
||||
s(:receiver, s(:string, "Hello"))))
|
||||
|
||||
machine = Register.machine.boot
|
||||
#do_clean_compile
|
||||
|
Loading…
Reference in New Issue
Block a user