From 5ece0621d3239012e4d219085eea36138cfb55c4 Mon Sep 17 00:00:00 2001
From: Botond Baranyi <botond.baranyi@ericsson.com>
Date: Wed, 30 Nov 2016 16:12:53 +0100
Subject: [PATCH] Fixed faulty timer.stop semantic analysis, caused by the 'any
 from' commit

Change-Id: Ieac33047f92834407740e5923b510a5f0d66399d
Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com>
---
 compiler2/ttcn3/Statement.cc | 16 ++++++++++++----
 compiler2/ttcn3/Statement.hh |  3 ++-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc
index fdb7ebae2..90ca67a33 100644
--- a/compiler2/ttcn3/Statement.cc
+++ b/compiler2/ttcn3/Statement.cc
@@ -2670,8 +2670,10 @@ namespace Ttcn {
       chk_start_timer();
       break;
     case S_STOP_TIMER:
+      chk_stop_timer();
+      break;
     case S_TIMEOUT:
-      chk_stop_timer_timeout();
+      chk_timer_timeout();
       break;
     case S_SETVERDICT:
       chk_setverdict();
@@ -2901,7 +2903,7 @@ namespace Ttcn {
       timer_op.timerref = dynamic_cast<Reference*>(t_ref);
       if (!timer_op.timerref) goto error;
       timer_op.value = 0;
-      chk_stop_timer_timeout();
+      chk_stop_timer();
       break;
     case Definition::A_CONST:
     case Definition::A_EXT_CONST:
@@ -4762,10 +4764,16 @@ error:
       }
     }
   }
+  
+  void Statement::chk_stop_timer()
+  {
+    Error_Context cntxt(this, "In stop timer statement");
+    chk_timer_ref(timer_op.timerref);
+  }
 
-  void Statement::chk_stop_timer_timeout()
+  void Statement::chk_timer_timeout()
   {
-    Error_Context cntxt(this, "In %s statement", get_stmt_name());
+    Error_Context cntxt(this, "In timeout statement");
     chk_timer_ref(timer_op.timerref, timer_op.any_from);
     if (timer_op.index_redirect != NULL && timer_op.timerref != NULL) {
       Common::Assignment* t_ass = timer_op.timerref->get_refd_assignment();
diff --git a/compiler2/ttcn3/Statement.hh b/compiler2/ttcn3/Statement.hh
index 53bf977c1..1f3aee591 100644
--- a/compiler2/ttcn3/Statement.hh
+++ b/compiler2/ttcn3/Statement.hh
@@ -705,7 +705,8 @@ namespace Ttcn {
     /* checks map and unmap */
     void chk_map();
     void chk_start_timer();
-    void chk_stop_timer_timeout();
+    void chk_stop_timer();
+    void chk_timer_timeout();
     void chk_setverdict();
     void chk_execute();
     void chk_execute_refd();
-- 
GitLab