@@ -400,6 +400,14 @@ bool Rule::evaluate(Transaction *trasn) {
400400 " variable `" + v->m_key + " ' (Value: `" + value + " ' )" ;
401401#ifndef NO_LOGS
402402 trasn->debug (4 , " Rule returned 1." );
403+ trasn->m_collections .storeOrUpdateFirst (" MATCHED_VAR" ,
404+ value);
405+ trasn->m_collections .storeOrUpdateFirst (" MATCHED_VAR_NAME" ,
406+ v->m_key );
407+ trasn->m_collections .store (" MATCHED_VARS:"
408+ + v->m_key , value);
409+ trasn->m_collections .store (" MATCHED_VARS_NAMES:"
410+ + v->m_key , v->m_key );
403411#endif
404412
405413 for (Action *a :
@@ -419,24 +427,7 @@ bool Rule::evaluate(Transaction *trasn) {
419427#ifndef NO_LOGS
420428 trasn->debug (4 , " Executing chained rule." );
421429#endif
422- if (trasn->m_collections .storeOrUpdateFirst (" MATCHED_VAR" ,
423- value) == false ) {
424- trasn->m_collections .store (" MATCHED_VAR" , value);
425- }
426- if (trasn->m_collections .storeOrUpdateFirst (
427- " MATCHED_VAR_NAME" , v->m_key ) == false ) {
428- trasn->m_collections .store (" MATCHED_VAR_NAME" ,
429- v->m_key );
430- }
431- trasn->m_collections .store (" MATCHED_VARS:"
432- + v->m_key , value);
433- trasn->m_collections .store (" MATCHED_VARS_NAMES:"
434- + v->m_key , v->m_key );
435430 chainResult = this ->chainedRule ->evaluate (trasn);
436- trasn->m_collections .storeOrUpdateFirst (" MATCHED_VAR" , " " );
437- trasn->m_collections .del (" MATCHED_VARS:" + v->m_key );
438- trasn->m_collections .del (" MATCHED_VARS_NAMES:" + v->m_key );
439- trasn->m_collections .del (" MATCHED_VARS_NAME" );
440431 }
441432 if ((this ->chained && chainResult == true ) || !this ->chained ) {
442433 for (Action *a :
@@ -509,6 +500,11 @@ bool Rule::evaluate(Transaction *trasn) {
509500 } else {
510501#ifndef NO_LOGS
511502 trasn->debug (4 , " Rule returned 0." );
503+ trasn->m_collections .storeOrUpdateFirst (" MATCHED_VAR" , " " );
504+ trasn->m_collections .del (" MATCHED_VARS:" + v->m_key );
505+ trasn->m_collections .del (" MATCHED_VARS_NAMES:" + v->m_key );
506+ trasn->m_collections .del (" MATCHED_VARS_NAME" );
507+
512508#endif
513509 }
514510 }
0 commit comments