From 70f912f94cd352a9e18c91ff466ca73464bf6b27 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 9 Nov 2015 23:29:14 +0200 Subject: [PATCH] allow message as keyword to access current message the ultimate in meta-programming --- lib/soml/compiler/name_expression.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/soml/compiler/name_expression.rb b/lib/soml/compiler/name_expression.rb index ba834362..0fc268a2 100644 --- a/lib/soml/compiler/name_expression.rb +++ b/lib/soml/compiler/name_expression.rb @@ -18,6 +18,11 @@ module Soml add_code Register::LoadConstant.new( statement, space , reg ) return reg end + if(name == :message) + reg = use_reg :Message + add_code Register::RegisterTransfer.new( statement, Register.message_reg , reg ) + return reg + end # either an argument, so it's stored in message if( index = @method.has_arg(name)) ret = use_reg @method.arguments[index].type