diff --git a/lib/register/builtin/kernel.rb b/lib/register/builtin/kernel.rb index 1f2b7f98..14c3b77d 100644 --- a/lib/register/builtin/kernel.rb +++ b/lib/register/builtin/kernel.rb @@ -10,7 +10,7 @@ module Register # no method enter or return (automatically added), remove new_start = Label.new(function , "__init__" ) function.instructions = new_start - function.source.current = new_start + function.source.set_current new_start #Set up the Space as self upon init space = Parfait::Space.object_space diff --git a/lib/register/method_source.rb b/lib/register/method_source.rb index aa11851d..52d472c7 100644 --- a/lib/register/method_source.rb +++ b/lib/register/method_source.rb @@ -58,8 +58,11 @@ module Register add_code FunctionReturn.new( self , Register.new_message_reg , Register.resolve_index(:message , :return_address) ) @current = enter end - attr_accessor :current , :method + attr_accessor :method + def set_current c + @current = c + end # add an instruction after the current (insertion point) # the added instruction will become the new insertion point def add_code instruction