small cleans
This commit is contained in:
parent
6bdbfcde60
commit
964abe1e32
@ -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"
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -14,9 +14,11 @@ module Virtual
|
|||||||
# 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
|
||||||
|
Loading…
Reference in New Issue
Block a user