fixes from the method argument change

Affects
method creation
argument manipulation
compiler / to_code
This commit is contained in:
Torsten Ruger
2016-12-13 18:49:45 +02:00
parent 2c5541fb19
commit 16b3a77350
8 changed files with 26 additions and 25 deletions

View File

@@ -5,9 +5,7 @@ module Typed
# return_type , name , parameters, kids , receiver = *statement
raise "Already in method #{@method}" if @method
args = statement.parameters.collect do |p|
Parfait::Variable.new( *p )
end
args = statement.parameters
class_method = handle_receiver( statement ) #nil for instance method

View File

@@ -12,7 +12,8 @@ module Typed
end
# either an argument, so it's stored in message
if( index = @method.has_arg(name))
ret = use_reg @method.arguments[index].value_type
ret = use_reg @method.argument_type(index)
#puts "For #{name} at #{index} got #{@method.arguments.inspect}"
add_code Register.get_slot(statement , :message , Parfait::Message.get_indexed(index), ret )
return ret
end
@@ -24,7 +25,7 @@ module Typed
def handle_local statement
index = @method.has_local( statement.name )
raise "must define variable '#{name}' before using it" unless index
raise "must define variable '#{statement.name}' before using it" unless index
frame = use_reg :Frame
add_code Register.get_slot(statement , :message , :frame , frame )
ret = use_reg @method.locals[index].value_type