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
|
||||
|
@ -14,9 +14,11 @@ module Virtual
|
||||
# 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