From c2d69c767c4a748b347c37d801d666f280e9db70 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Tue, 3 Apr 2018 19:35:25 +0300 Subject: [PATCH] hello world runs through MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit slower it seems and source view doesn’t work yet --- config.ru | 8 ++++---- lib/{debugger.rb => debugger.js.rb} | 1 + lib/views/object_view.rb | 4 ++-- lib/views/source_view.rb | 4 +--- 4 files changed, 8 insertions(+), 9 deletions(-) rename lib/{debugger.rb => debugger.js.rb} (97%) diff --git a/config.ru b/config.ru index a06810f..03d6617 100644 --- a/config.ru +++ b/config.ru @@ -25,12 +25,12 @@ class DebugServer < Opal::Server end end -run DebugServer.new { |s| - s.main = 'debugger' +run Opal::Server.new { |s| + s.main = 'debugger.js.rb' s.append_path 'lib' s.append_path 'assets' - s.debug = !ENV["DEBUG"].nil? - s.source_map = true +# s.debug = !ENV["DEBUG"].nil? +# s.source_map = true s.index_path = "index.html.erb" s.sprockets.cache = Sprockets::Cache::MemoryStore.new(5000) } diff --git a/lib/debugger.rb b/lib/debugger.js.rb similarity index 97% rename from lib/debugger.rb rename to lib/debugger.js.rb index 6d5294d..5ec7a1b 100644 --- a/lib/debugger.rb +++ b/lib/debugger.js.rb @@ -1,6 +1,7 @@ require "opal" require "opal-parser" +require 'opal/compiler' require "logger" require 'browser' diff --git a/lib/views/object_view.rb b/lib/views/object_view.rb index 430bedf..0783364 100644 --- a/lib/views/object_view.rb +++ b/lib/views/object_view.rb @@ -18,7 +18,7 @@ class ObjectView < ListView return @element end - def object_changed reg , at + def object_changed( reg , at) #puts "Object changed in #{reg} , at #{at}" for_object = @interpreter.get_register( reg ) return unless for_object == @object @@ -27,7 +27,7 @@ class ObjectView < ListView if(variable) f = @object.get_instance_variable(variable) else - variable = (at - @object.class.get_length_index).to_s + variable = at.to_s f = @object.get_internal_word(at) end #puts "got var name #{variable}#{variable.class} for #{at}, #{f}" diff --git a/lib/views/source_view.rb b/lib/views/source_view.rb index 409203a..752a177 100644 --- a/lib/views/source_view.rb +++ b/lib/views/source_view.rb @@ -39,9 +39,7 @@ class SourceView < ElementView def update_method i = @interpreter.instruction if i.is_a?(Risc::FunctionReturn) - object = @interpreter.get_register( i.register ) - #puts "Object #{object}" - link = object.get_internal_word( i.index ) + link = @interpreter.get_register( i.register ) #puts "Link #{link}" raise "No link method" unless link i = link