rename frame to named_list to be shared soon
This commit is contained in:
@ -23,9 +23,9 @@ module Typed
|
||||
index = @method.has_local( name )
|
||||
return nil unless index
|
||||
# TODO, check type @method.locals[index].type
|
||||
frame = use_reg(:Frame)
|
||||
frame = use_reg(:NamedList)
|
||||
add_code Register.get_slot(statement , :message , :frame , frame )
|
||||
return Register.set_slot(statement , value , frame , Parfait::Frame.get_indexed(index) )
|
||||
return Register.set_slot(statement , value , frame , Parfait::NamedList.get_indexed(index) )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -26,10 +26,10 @@ module Typed
|
||||
def handle_local statement
|
||||
index = @method.has_local( statement.name )
|
||||
raise "must define variable '#{statement.name}' before using it" unless index
|
||||
frame = use_reg :Frame
|
||||
frame = use_reg :NamedList
|
||||
add_code Register.get_slot(statement , :message , :frame , frame )
|
||||
ret = use_reg @method.locals_type( index )
|
||||
add_code Register.get_slot(statement , frame , Parfait::Frame.get_indexed(index), ret )
|
||||
add_code Register.get_slot(statement , frame , Parfait::NamedList.get_indexed(index), ret )
|
||||
return ret
|
||||
end
|
||||
|
||||
|
@ -14,6 +14,6 @@ require_relative "parfait/meta_class"
|
||||
require_relative "parfait/dictionary"
|
||||
require_relative "parfait/type"
|
||||
require_relative "parfait/message"
|
||||
require_relative "parfait/frame"
|
||||
require_relative "parfait/named_list"
|
||||
require_relative "parfait/space"
|
||||
require_relative "parfait/symbol_adapter"
|
||||
|
@ -17,7 +17,7 @@ module Parfait
|
||||
|
||||
def initialize next_m
|
||||
self.next_message = next_m
|
||||
self.frame = Frame.new()
|
||||
self.frame = NamedList.new()
|
||||
self.caller = nil
|
||||
super()
|
||||
end
|
||||
|
@ -1,29 +1,30 @@
|
||||
|
||||
# A Frame is set up by functions that use local variables or temporary variables
|
||||
# in fact temporary variables are local variables named by the system
|
||||
# A NamedList is for local variables arguments when calling methods.
|
||||
# Also temporary variables, which are local variables named by the system
|
||||
|
||||
# It allows for access to those variables basically
|
||||
# The items are named (and typed) by the objects type instance. In effect the
|
||||
# variables are like instance variables
|
||||
|
||||
# A Message and a Frame make up the two sides of message passing:
|
||||
# A Message with is arguments, and a NamedList make up the two sides of message passing:
|
||||
# A Message (see details there) is created by the caller and control is transferred
|
||||
# A Frame is created by the receiver
|
||||
# A NamedList is created by the receiver
|
||||
# PS: it turns out that both messages and frames are created at compile, not run-time, and
|
||||
# just constantly reused. Each message has a frame object ready and is also linked
|
||||
# to the next message.
|
||||
# The better way to say above is that a message is *used* by the caller, and a frame by the callee.
|
||||
|
||||
# Also at runtime Messages and Frames remain completely "normal" objects.
|
||||
# Also at runtime Messages and NamedLists remain completely "normal" objects.
|
||||
# Ie they have have type and instances and so on.*
|
||||
# Which resolves the dichotomy of objects on the stack or heap. Sama sama.
|
||||
#
|
||||
# *Alas the type for each call instance is unique.
|
||||
#
|
||||
module Parfait
|
||||
class Frame < Object
|
||||
attribute :next_frame
|
||||
class NamedList < Object
|
||||
attribute :next_list
|
||||
|
||||
include Indexed
|
||||
self.offset(2) # 1 == the next_frame attributes above + type. (indexed_length gets added)
|
||||
self.offset(2) # 1 == the next_list attributes above + type. (indexed_length gets added)
|
||||
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user