From 37564d9c2e54ccb6671d99fb63d1cf4fc56b73b8 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sun, 8 Nov 2015 13:55:38 +0200 Subject: [PATCH] implement message pseudo variable (like self) too easy also simplified some tests --- lib/soml/compiler/field_access.rb | 4 +-- test/compiler/statements/test_fields.rb | 46 ++++++++++++++++++------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/lib/soml/compiler/field_access.rb b/lib/soml/compiler/field_access.rb index e7f358ca..e1dc8321 100644 --- a/lib/soml/compiler/field_access.rb +++ b/lib/soml/compiler/field_access.rb @@ -18,7 +18,7 @@ module Soml add_code move when :message #message Slot - raise "message not yet" + value = Register.message_reg else if( index = @method.has_arg(receiver)) #argument value = use_reg @method.arguments[index].type @@ -31,7 +31,7 @@ module Soml add_code Register.get_slot(statement , :message , :frame , frame ) code = Register.get_slot(statement ,frame , Parfait::Frame.get_indexed(index) , value ) else - raise "Variable not defined #{name}" + raise "Variable not defined #{receiver}" end end end diff --git a/test/compiler/statements/test_fields.rb b/test/compiler/statements/test_fields.rb index bb713145..59faef9a 100644 --- a/test/compiler/statements/test_fields.rb +++ b/test/compiler/statements/test_fields.rb @@ -7,13 +7,10 @@ module Register def test_field_frame @string_input = <