small checks

This commit is contained in:
Torsten Ruger 2015-08-06 18:27:25 +03:00
parent c0071c947d
commit 2c6ca7b4f2
4 changed files with 5 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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