passing frame (locals) into method creation

so typed_method have correct frame information and
can resolve slots correctly (next step)
This commit is contained in:
Torsten Ruger
2018-03-18 22:09:27 +05:30
parent 0813312ddc
commit af94d40cab
4 changed files with 30 additions and 13 deletions

View File

@ -74,14 +74,18 @@ module Parfait
names
end
def create_method( method_name , arguments )
def create_method( method_name , arguments , frame)
raise "create_method #{method_name}.#{method_name.class}" unless method_name.is_a?(Symbol)
#puts "Self: #{self.class} clazz: #{clazz.name}"
found = get_method( method_name )
#TODO check types and then what ?
return found if found
arg_type = arguments
arg_type = NamedList.type_for( arguments ) if arguments.is_a?(Hash)
add_method TypedMethod.new( self , method_name , arg_type )
if arguments.is_a?(Hash)
raise "May want to get rid of this way"
arguments = NamedList.type_for( arguments )
end
raise "frame must be a type, not:#{frame}" unless frame.is_a?(Type)
add_method TypedMethod.new( self , method_name , arguments , frame )
end
def add_method( method )