passing compiler to to_mom, not method
To be able to delegate scope (block/method) things later
This commit is contained in:
@ -46,11 +46,11 @@ module Vool
|
||||
# A Send breaks down to 2 steps:
|
||||
# - Setting up the next message, with receiver, arguments, and (importantly) return address
|
||||
# - a SimpleCall,
|
||||
def to_mom( in_method )
|
||||
@parfait_block = @block.to_mom(in_method) if @block
|
||||
@receiver = SelfExpression.new(in_method.for_type) if @receiver.is_a?(SelfExpression)
|
||||
def to_mom( compiler )
|
||||
@parfait_block = @block.to_mom(compiler) if @block
|
||||
@receiver = SelfExpression.new(compiler.for_type) if @receiver.is_a?(SelfExpression)
|
||||
if(@receiver.ct_type)
|
||||
simple_call(in_method)
|
||||
simple_call(compiler)
|
||||
else
|
||||
raise "ERROR"
|
||||
end
|
||||
@ -58,17 +58,17 @@ module Vool
|
||||
|
||||
# When used as right hand side, this tells what data to move to get the result into
|
||||
# a varaible. It is (off course) the return value of the message
|
||||
def slot_definition(in_method)
|
||||
def slot_definition(compiler)
|
||||
Mom::SlotDefinition.new(:message ,[ :return_value])
|
||||
end
|
||||
|
||||
def message_setup(in_method,called_method)
|
||||
setup = Mom::MessageSetup.new( called_method )
|
||||
mom_receive = @receiver.slot_definition(in_method)
|
||||
mom_receive = @receiver.slot_definition(compiler)
|
||||
arg_target = [:message , :next_message , :arguments]
|
||||
args = []
|
||||
@arguments.each_with_index do |arg , index| # +1 because of type
|
||||
args << Mom::SlotLoad.new( arg_target + [index + 1] , arg.slot_definition(in_method))
|
||||
args << Mom::SlotLoad.new( arg_target + [index + 1] , arg.slot_definition(compiler))
|
||||
end
|
||||
setup << Mom::ArgumentTransfer.new( mom_receive , args )
|
||||
end
|
||||
|
Reference in New Issue
Block a user