small cleans

This commit is contained in:
Torsten Ruger 2015-09-27 12:59:26 +03:00
parent 6bdbfcde60
commit 964abe1e32
4 changed files with 10 additions and 6 deletions

View File

@ -34,7 +34,9 @@ module Bosl
end end
require_relative "ast_helper" require_relative "ast_helper"
require_relative "compiler/basic_expressions"
require_relative "compiler/callsite_expression" require_relative "compiler/callsite_expression"
require_relative "compiler/class_field"
require_relative "compiler/compound_expressions" require_relative "compiler/compound_expressions"
require_relative "compiler/expression_list" require_relative "compiler/expression_list"
require_relative "compiler/field_def" require_relative "compiler/field_def"

View File

@ -4,7 +4,7 @@ module Bosl
def on_field_def expression def on_field_def expression
# puts expression.inspect # puts expression.inspect
type , name , value = *expression type , name , value = *expression
name = name
index = method.ensure_local( name ) index = method.ensure_local( name )
if value if value

View File

@ -11,10 +11,10 @@ module Bosl
# either an argument, so it's stored in message # either an argument, so it's stored in message
ret = Virtual::Return.new :int ret = Virtual::Return.new :int
if( index = method.has_arg(name)) 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 else # or a local so it is in the frame
index = method.ensure_local( name ) 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 end
return ret return ret
end end

View File

@ -7,16 +7,18 @@ module Virtual
# The slot in the Message is represented by instances of class Self # The slot in the Message is represented by instances of class Self
# (and slots in the next_message by instances of NewSelf) # (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 # 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 # In Summary: class Self represents the self object and SelfSlot instances variables of
# that object # that object
# #
class SelfSlot < Slot class SelfSlot < Slot
def initialize type , value = nil def initialize index , type , value = nil
super @index = index
super( type , value )
end end
attr_reader :index
def object_name def object_name
:self :self
end end