makeing the method of the compiler more or less private

in preparation for using the same code for bocks
This commit is contained in:
Torsten Ruger
2018-07-09 19:32:17 +03:00
parent 63b55f2aa4
commit edea9ac080
13 changed files with 45 additions and 35 deletions

View File

@ -70,7 +70,7 @@ module Vool
@my_type = type
end
def slot_definition(compiler)
@my_type = compiler.method.self_type
@my_type = compiler.resolve_type(:receiver)
Mom::SlotDefinition.new(:message , [:receiver])
end
def ct_type

View File

@ -21,7 +21,7 @@ module Vool
# to the method compiler for further processing
def to_mom( compiler )
parfait_block = self.parfait_block(compiler)
block_compiler = Risc::BlockCompiler.new( parfait_block , compiler.method )
block_compiler = Risc::BlockCompiler.new( parfait_block , compiler.get_method )
compiler.add_block_compiler(block_compiler)
head = body.to_mom( block_compiler )
#block_compiler.add_mom(head)
@ -41,7 +41,7 @@ module Vool
# to CallableMethod)
def parfait_block(compiler)
return @parfait_block if @parfait_block
@parfait_block = compiler.method.create_block( make_arg_type , make_frame(compiler))
@parfait_block = compiler.create_block( make_arg_type , make_frame(compiler))
end
private

View File

@ -72,7 +72,7 @@ module Vool
# - Setting up the next message, with receiver, arguments, and (importantly) return address
# - a CachedCall , or a SimpleCall, depending on wether the receiver type can be determined
def to_mom( compiler )
@receiver = SelfExpression.new(compiler.method.self_type) if @receiver.is_a?(SelfExpression)
@receiver = SelfExpression.new(compiler.resolve_type(:receiver)) if @receiver.is_a?(SelfExpression)
if(@receiver.ct_type)
simple_call(compiler)
else

View File

@ -11,12 +11,8 @@ module Vool
class LocalVariable < Expression
include Named
def slot_definition(compiler)
if compiler.method.arguments_type.variable_index(@name)
type = :arguments
else
type = :frame
end
Mom::SlotDefinition.new(:message , [type , @name])
slot_def = compiler.slot_type_for(@name)
Mom::SlotDefinition.new(:message , slot_def)
end
def to_s
name.to_s