split create method
to allow class methods to use the other half
This commit is contained in:
parent
99870c92d8
commit
f22eca053d
@ -24,13 +24,15 @@ module Register
|
|||||||
# compile code then works with the method, but adds code tot the info
|
# compile code then works with the method, but adds code tot the info
|
||||||
def self.create_method( class_name , return_type , method_name , args)
|
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 #{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
|
clazz = Register.machine.space.get_class_by_name class_name
|
||||||
raise "No such class #{class_name}" unless clazz
|
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 = []
|
arguments = []
|
||||||
args.each_with_index do | arg , index |
|
args.each_with_index do | arg , index |
|
||||||
unless arg.is_a? Parfait::Variable
|
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
|
arg = Parfait::Variable.new arg , "arg#{index}".to_sym
|
||||||
end
|
end
|
||||||
arguments << arg
|
arguments << arg
|
||||||
|
Loading…
Reference in New Issue
Block a user