split create method

to allow class methods to use the other half
This commit is contained in:
Torsten Ruger 2015-10-25 15:04:40 +02:00
parent 99870c92d8
commit f22eca053d

View File

@ -24,13 +24,15 @@ module Register
# compile code then works with the method, but adds code tot the info
def self.create_method( class_name , return_type , method_name , args)
raise "create_method #{class_name}.#{class_name.class}" unless class_name.is_a? Symbol
raise "create_method #{method_name}.#{method_name.class}" unless method_name.is_a? Symbol
clazz = Register.machine.space.get_class_by_name class_name
raise "No such class #{class_name}" unless clazz
create_method_for( clazz , return_type , method_name , args)
end
def self.create_method_for clazz , return_type , method_name , args
raise "create_method #{method_name}.#{method_name.class}" unless method_name.is_a? Symbol
arguments = []
args.each_with_index do | arg , index |
unless arg.is_a? Parfait::Variable
raise "not type #{arg}:#{arg.class}" unless Register.machine.space.get_class_by_name arg
arg = Parfait::Variable.new arg , "arg#{index}".to_sym
end
arguments << arg