From 202badb0448abc1795769af6d5d4156f7e1a0a43 Mon Sep 17 00:00:00 2001 From: Botond Baranyi <botond.baranyi@ericsson.com> Date: Fri, 16 Oct 2020 17:27:15 +0200 Subject: [PATCH] Fixed system component detection in functions with return values (bug 566094) Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com> Change-Id: Ib8e1aacf1d8ec53dc260f28dec9ab0ce084f86c3 Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com> --- compiler2/ttcn3/Statement.cc | 5 ++++- regression_test/map_param/common.ttcn | 19 +++++++++++++++++++ .../map_param/single_mode/single.cfg | 2 +- .../map_param/single_mode/single_test.ttcn | 5 +++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc index 9c69f8e88..b0e6c384f 100644 --- a/compiler2/ttcn3/Statement.cc +++ b/compiler2/ttcn3/Statement.cc @@ -189,7 +189,10 @@ namespace Ttcn { // is the same as the type of 'mtc' (which is given in 'runs on' clause) } return my_def->get_RunsOnType(); - } else if (asstype == Common::Assignment::A_FUNCTION || asstype == Common::Assignment::A_ALTSTEP) { + } else if (asstype == Common::Assignment::A_FUNCTION || + asstype == Common::Assignment::A_FUNCTION_RVAL || + asstype == Common::Assignment::A_FUNCTION_RTEMP || + asstype == Common::Assignment::A_ALTSTEP) { if (is_system) { return my_def->get_SystemType(); } else { diff --git a/regression_test/map_param/common.ttcn b/regression_test/map_param/common.ttcn index fc9d4da70..93ea19ea4 100644 --- a/regression_test/map_param/common.ttcn +++ b/regression_test/map_param/common.ttcn @@ -67,4 +67,23 @@ function f_check_calls() runs on CT { } } +function f_test_params_retval(CT p_comp) runs on CT system CT return integer { + var IntList v_p2 := P2_INITIAL; + map(p_comp:pt, system:pt) param (-, v_p2); + if (v_p2 != P2_FINAL) { + setverdict(fail, "Final value of parameter p2 is incorrect: ", v_p2); + } + + var integer v_p := P_INITIAL; + unmap(p_comp:pt, system:pt) param(v_p); + if (v_p != P_FINAL) { + setverdict(fail, "Final value of parameter p is incorrect: ", v_p); + } + + map(p_comp:pt, system:pt); + unmap(p_comp:pt, system:pt); + + return 0; +} + } diff --git a/regression_test/map_param/single_mode/single.cfg b/regression_test/map_param/single_mode/single.cfg index bca59449f..fdadfc13e 100644 --- a/regression_test/map_param/single_mode/single.cfg +++ b/regression_test/map_param/single_mode/single.cfg @@ -17,4 +17,4 @@ ConsoleMask := TTCN_WARNING | TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS [EXECUTE] single_test.tc_single - +single_test.tc_single_retval diff --git a/regression_test/map_param/single_mode/single_test.ttcn b/regression_test/map_param/single_mode/single_test.ttcn index b172b303c..2b1d4e181 100644 --- a/regression_test/map_param/single_mode/single_test.ttcn +++ b/regression_test/map_param/single_mode/single_test.ttcn @@ -20,4 +20,9 @@ testcase tc_single() runs on CT { f_check_calls(); } +testcase tc_single_retval() runs on CT { + f_test_params_retval(mtc); + f_check_calls(); +} + } -- GitLab