push the name down into callable

blocks need a name too
if just for debug, and stacks
This commit is contained in:
Torsten Ruger
2018-07-30 10:21:43 +03:00
parent 1cb07a4164
commit 4055709529
8 changed files with 25 additions and 18 deletions

View File

@ -13,11 +13,14 @@ module Parfait
class Callable < Object
attr_reader :self_type , :arguments_type , :frame_type , :binary
attr_reader :blocks, :next
def initialize( self_type , arguments_type , frame_type)
attr_reader :blocks, :next , :name
def initialize( name , self_type , arguments_type , frame_type)
super()
raise "No class #{self}" unless self_type
raise "For type, not class #{self_type}" unless self_type.is_a?(Type)
raise "Mixup" unless name.is_a?(Symbol)
@name = name
@self_type = self_type
init(arguments_type, frame_type)
end

View File

@ -11,13 +11,6 @@ module Parfait
class CallableMethod < Callable
attr_reader :name
def initialize( self_type , name , arguments_type , frame_type)
@name = name
super(self_type , arguments_type , frame_type)
end
def ==(other)
return false unless other.is_a?(CallableMethod)
return false if @name != other.name
@ -38,7 +31,8 @@ module Parfait
end
def create_block(args , frame)
add_block( Block.new(self_type , args , frame))
block_name = "#{@name}_block".to_sym #TODO with id, to distinguish
add_block( Block.new(block_name , self_type , args , frame))
end
def add_block(bl)

View File

@ -101,7 +101,7 @@ module Parfait
found.init(arguments , frame)
return found
else
add_method CallableMethod.new( self , method_name , arguments , frame )
add_method CallableMethod.new( method_name , self , arguments , frame )
end
end