moving to instance variables in parfait

This commit is contained in:
2019-09-09 20:26:54 +03:00
parent fc8de10964
commit 81e3c0c270
21 changed files with 212 additions and 187 deletions

View File

@ -12,9 +12,9 @@ module Parfait
#
class Callable < Object
attr :type, :self_type , :arguments_type , :frame_type , :binary
attr :blocks , :name
attr :next_callable
attr_reader :type, :self_type , :arguments_type , :frame_type , :binary
attr_reader :blocks , :name
attr_reader :next_callable
def self.type_length
8
@ -25,8 +25,8 @@ module Parfait
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)
self.name = name
self.self_type = self_type
@name = name
@self_type = self_type
init(arguments_type, frame_type)
end
@ -38,9 +38,9 @@ module Parfait
def init(arguments_type, frame_type)
raise "Wrong argument type, expect Type not #{arguments_type.class}" unless arguments_type.is_a? Type
raise "Wrong frame type, expect Type not #{frame_type.class}" unless frame_type.is_a? Type
self.arguments_type = arguments_type
self.frame_type = frame_type
self.binary = BinaryCode.new(0)
@arguments_type = arguments_type
@frame_type = frame_type
@binary = BinaryCode.new(0)
end
# determine if method has a local variable or tmp (anonymous local) by given name
@ -52,7 +52,7 @@ module Parfait
def add_local( name , type )
index = has_local( name )
return index if index
self.frame_type = frame_type.add_instance_variable(name,type)
@frame_type = frame_type.add_instance_variable(name,type)
end
def each_binary( &block )
@ -64,7 +64,7 @@ module Parfait
end
def set_next( method )
self.next_callable = method
@next_callable = method
end
end