From 09932bb3a51c69e028cf13bc5fc35689452362d0 Mon Sep 17 00:00:00 2001
From: Botond Baranyi <botond.baranyi@ericsson.com>
Date: Mon, 5 Dec 2016 12:08:33 +0100
Subject: [PATCH] Further fixes to the 'any from' clause implementation

Change-Id: I2e1837db2c37395925b1c89ae988c73b89826994
Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com>
---
 compiler2/Value.cc           | 14 ++++++++------
 compiler2/ttcn3/Statement.cc | 11 +++++++++++
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/compiler2/Value.cc b/compiler2/Value.cc
index b5e219a90..a03df6b01 100644
--- a/compiler2/Value.cc
+++ b/compiler2/Value.cc
@@ -10575,17 +10575,19 @@ error:
       }
       label_r1:
       // no break
-    case OPTYPE_UNDEF_RUNNING: // r1 [r2] b4
+    case OPTYPE_TMR_READ: {     // r1
+      Common::Assignment *ass = u.expr.r1->get_refd_assignment();
+      self_ref |= (ass == lhs);
+      break; }
+    case OPTYPE_UNDEF_RUNNING: { // r1 [r2] b4
       if (u.expr.r2 != NULL) {
-        Common::Assignment *ass = u.expr.r2->get_refd_assignment();
-        self_ref |= (ass == lhs);
+        Common::Assignment *ass2 = u.expr.r2->get_refd_assignment();
+        self_ref |= (ass2 == lhs);
       }
-      // no break
-    case OPTYPE_TMR_READ: {     // r1
       Common::Assignment *ass = u.expr.r1->get_refd_assignment();
       self_ref |= (ass == lhs);
       break; }
-
+    
     case OPTYPE_ISCHOSEN_T: // t1 i2
     case OPTYPE_ISBOUND: // ti1
     case OPTYPE_ISVALUE: // ti1
diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc
index 3db410915..0fd310782 100644
--- a/compiler2/ttcn3/Statement.cc
+++ b/compiler2/ttcn3/Statement.cc
@@ -653,6 +653,8 @@ namespace Ttcn {
       break;
     case S_STOP_COMP:
     case S_KILL:
+      delete comp_op.compref;
+      break;
     case S_KILLED:
       delete comp_op.compref;
       delete comp_op.index_redirect;
@@ -1349,6 +1351,9 @@ namespace Ttcn {
   {
     switch (statementtype) {
     case S_DONE:
+      comp_op.donereturn.donematch = NULL;
+      comp_op.donereturn.redirect = NULL;
+      // no break
     case S_KILLED:
       comp_op.compref = 0;
       comp_op.any_or_all = p_anyall;
@@ -1814,6 +1819,8 @@ namespace Ttcn {
       break;
     case S_STOP_COMP:
     case S_KILL:
+      if (comp_op.compref) comp_op.compref->set_my_scope(p_scope);
+      break;
     case S_KILLED:
       if (comp_op.compref) comp_op.compref->set_my_scope(p_scope);
       if (comp_op.index_redirect != NULL) {
@@ -2087,6 +2094,8 @@ namespace Ttcn {
       break;
     case S_STOP_COMP:
     case S_KILL:
+      if (comp_op.compref) comp_op.compref->set_fullname(p_fullname+".compref");
+      break;
     case S_KILLED:
       if (comp_op.compref) comp_op.compref->set_fullname(p_fullname+".compref");
       if (comp_op.index_redirect != NULL) {
@@ -5683,6 +5692,8 @@ error:
       break;
     case S_STOP_COMP:
     case S_KILL:
+      if (comp_op.compref) comp_op.compref->set_code_section(p_code_section);
+      break;
     case S_KILLED:
       if (comp_op.compref) comp_op.compref->set_code_section(p_code_section);
       if (comp_op.index_redirect != NULL) {
-- 
GitLab