checking return type is a type

This commit is contained in:
Torsten Ruger
2015-10-14 14:02:34 +03:00
parent e33a20dd41
commit d899d542a4
5 changed files with 17 additions and 15 deletions

View File

@ -56,7 +56,7 @@ module Phisol
raise "unimplemented: \n#{code} \nfor #{ref.inspect}"
end
else
if( me.type == :int)
if( me.type.is_a? Phisol::Integer)
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

View File

@ -40,13 +40,10 @@ module Phisol
@method.source.receiver = r
puts "compile method #{@method.name}"
#frame = frame.new_frame
kids.to_a.each do |ex|
return_type = process(ex)
raise return_type.inspect if return_type.is_a? Virtual::Instruction
ret = process(ex)
raise ret.inspect if ret.is_a? Virtual::Instruction
end
@method.source.return_type = return_type
@method = nil
Virtual::Return.new(return_type)
end