small cleans
This commit is contained in:
parent
6bdbfcde60
commit
964abe1e32
@ -34,7 +34,9 @@ module Bosl
|
||||
end
|
||||
|
||||
require_relative "ast_helper"
|
||||
require_relative "compiler/basic_expressions"
|
||||
require_relative "compiler/callsite_expression"
|
||||
require_relative "compiler/class_field"
|
||||
require_relative "compiler/compound_expressions"
|
||||
require_relative "compiler/expression_list"
|
||||
require_relative "compiler/field_def"
|
||||
|
@ -4,7 +4,7 @@ module Bosl
|
||||
def on_field_def expression
|
||||
# puts expression.inspect
|
||||
type , name , value = *expression
|
||||
name = name
|
||||
|
||||
index = method.ensure_local( name )
|
||||
|
||||
if value
|
||||
|
@ -11,10 +11,10 @@ module Bosl
|
||||
# either an argument, so it's stored in message
|
||||
ret = Virtual::Return.new :int
|
||||
if( index = method.has_arg(name))
|
||||
method.source.add_code Virtual::Set.new( Virtual::ArgSlot.new(:int,index ) , ret)
|
||||
method.source.add_code Virtual::Set.new( Virtual::ArgSlot.new(index,:int ) , ret)
|
||||
else # or a local so it is in the frame
|
||||
index = method.ensure_local( name )
|
||||
method.source.add_code Virtual::Set.new(Virtual::FrameSlot.new(:int,index ) , ret )
|
||||
method.source.add_code Virtual::Set.new(Virtual::FrameSlot.new(index,:int ) , ret )
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
@ -7,16 +7,18 @@ module Virtual
|
||||
# The slot in the Message is represented by instances of class Self
|
||||
# (and slots in the next_message by instances of NewSelf)
|
||||
#
|
||||
# Additionally the current Self is represented as it's own top-level object.
|
||||
# Additionally the current Self is represented as it's own top-level object.
|
||||
# If self is an Object one can refer to it's instance variables as Slots in SelfSlot
|
||||
#
|
||||
# In Summary: class Self represents the self object and SelfSlot instances variables of
|
||||
# that object
|
||||
#
|
||||
class SelfSlot < Slot
|
||||
def initialize type , value = nil
|
||||
super
|
||||
def initialize index , type , value = nil
|
||||
@index = index
|
||||
super( type , value )
|
||||
end
|
||||
attr_reader :index
|
||||
def object_name
|
||||
:self
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user