From 2c6ca7b4f26003af0054f95021218805571c34e8 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Thu, 6 Aug 2015 18:27:25 +0300 Subject: [PATCH] small checks --- lib/parfait/method.rb | 1 + lib/virtual/instructions/set.rb | 1 + lib/virtual/passes/collector.rb | 2 ++ lib/virtual/passes/send_implementation.rb | 1 + 4 files changed, 5 insertions(+) diff --git a/lib/parfait/method.rb b/lib/parfait/method.rb index 07e92146..6a96e67c 100644 --- a/lib/parfait/method.rb +++ b/lib/parfait/method.rb @@ -25,6 +25,7 @@ module Parfait self.for_class = clazz self.name = name self.code = BinaryCode.new name + raise "Wrong type, expect List not #{arg_names.class}" unless arg_names.is_a? List self.arg_names = arg_names self.locals = List.new self.tmps = List.new diff --git a/lib/virtual/instructions/set.rb b/lib/virtual/instructions/set.rb index b43e5230..37a476aa 100644 --- a/lib/virtual/instructions/set.rb +++ b/lib/virtual/instructions/set.rb @@ -6,6 +6,7 @@ module Virtual # from may be a Constant (Object,Integer,String,Class) class Set < Instruction def initialize from , to + raise "no to slot #{to}" unless to.is_a? Slot @from = from @to = to end diff --git a/lib/virtual/passes/collector.rb b/lib/virtual/passes/collector.rb index 435b3fe0..0014a0ea 100644 --- a/lib/virtual/passes/collector.rb +++ b/lib/virtual/passes/collector.rb @@ -23,11 +23,13 @@ module Virtual layout = object.get_layout keep(layout , depth + 1) layout.object_instance_names.each do |name| + #puts "Keep #{name}" inst = object.get_instance_variable name keep(inst , depth + 1) end if object.is_a? Parfait::List object.each do |item| + #puts "Keep item " keep(item , depth + 1) end end diff --git a/lib/virtual/passes/send_implementation.rb b/lib/virtual/passes/send_implementation.rb index d34115da..8ba4505a 100644 --- a/lib/virtual/passes/send_implementation.rb +++ b/lib/virtual/passes/send_implementation.rb @@ -35,6 +35,7 @@ module Virtual name = code.name name = :plus if name == :+ method = Virtual.machine.space.get_class_by_name(:Integer).get_instance_method(name) + #puts Virtual.machine.space.get_class_by_name(:Integer).method_names.to_a raise "Method not implemented Integer.#{name}" unless method new_codes << MethodCall.new( method ) else