small checks
This commit is contained in:
parent
c0071c947d
commit
2c6ca7b4f2
@ -25,6 +25,7 @@ module Parfait
|
|||||||
self.for_class = clazz
|
self.for_class = clazz
|
||||||
self.name = name
|
self.name = name
|
||||||
self.code = BinaryCode.new 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.arg_names = arg_names
|
||||||
self.locals = List.new
|
self.locals = List.new
|
||||||
self.tmps = List.new
|
self.tmps = List.new
|
||||||
|
@ -6,6 +6,7 @@ module Virtual
|
|||||||
# from may be a Constant (Object,Integer,String,Class)
|
# from may be a Constant (Object,Integer,String,Class)
|
||||||
class Set < Instruction
|
class Set < Instruction
|
||||||
def initialize from , to
|
def initialize from , to
|
||||||
|
raise "no to slot #{to}" unless to.is_a? Slot
|
||||||
@from = from
|
@from = from
|
||||||
@to = to
|
@to = to
|
||||||
end
|
end
|
||||||
|
@ -23,11 +23,13 @@ module Virtual
|
|||||||
layout = object.get_layout
|
layout = object.get_layout
|
||||||
keep(layout , depth + 1)
|
keep(layout , depth + 1)
|
||||||
layout.object_instance_names.each do |name|
|
layout.object_instance_names.each do |name|
|
||||||
|
#puts "Keep #{name}"
|
||||||
inst = object.get_instance_variable name
|
inst = object.get_instance_variable name
|
||||||
keep(inst , depth + 1)
|
keep(inst , depth + 1)
|
||||||
end
|
end
|
||||||
if object.is_a? Parfait::List
|
if object.is_a? Parfait::List
|
||||||
object.each do |item|
|
object.each do |item|
|
||||||
|
#puts "Keep item "
|
||||||
keep(item , depth + 1)
|
keep(item , depth + 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -35,6 +35,7 @@ module Virtual
|
|||||||
name = code.name
|
name = code.name
|
||||||
name = :plus if name == :+
|
name = :plus if name == :+
|
||||||
method = Virtual.machine.space.get_class_by_name(:Integer).get_instance_method(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
|
raise "Method not implemented Integer.#{name}" unless method
|
||||||
new_codes << MethodCall.new( method )
|
new_codes << MethodCall.new( method )
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user