change method locals to type object too (same as args)

This commit is contained in:
Torsten Ruger
2016-12-13 19:18:17 +02:00
parent 16b3a77350
commit 012b5d683c
7 changed files with 69 additions and 26 deletions

View File

@@ -7,7 +7,7 @@ module Typed
reset_regs # field_def is a statement, no return and all regs
name_s = no_space( statement.name.value )
@method.ensure_local( name_s, statement.type ) unless( @method.has_arg(name_s))
@method.add_local( name_s, statement.type ) unless( @method.has_arg(name_s))
# if there is a value assigned, process it as am assignemnt statement (kind of call on_assign)
process( Tree::Assignment.new(statement.name , statement.value ) ) if statement.value
return nil

View File

@@ -28,7 +28,7 @@ module Typed
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
ret = use_reg @method.locals_type( index )
add_code Register.get_slot(statement , frame , Parfait::Frame.get_indexed(index), ret )
return ret
end