Commit 9091d420 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Fixed scope in code generation for multi-layered default value



Change-Id: I75a1779927036838d39e1409927bdcfc1ac80aeb
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent b9c779d1
......@@ -522,6 +522,14 @@ namespace Ttcn {
return new Reference(*this);
}
void Reference::set_my_scope(Scope *p_scope)
{
Ref_base::set_my_scope(p_scope);
if (parlist != NULL) {
parlist->set_my_scope(p_scope);
}
}
string Reference::get_dispname()
{
string ret_val;
......
......@@ -327,6 +327,7 @@ namespace Ttcn {
: Ref_base(p_modid, p_id), parlist(0) { }
~Reference();
virtual Reference *clone() const;
virtual void set_my_scope(Scope* p_scope);
virtual string get_dispname();
virtual Common::Assignment *get_refd_assignment(bool check_parlist = true);
virtual const Identifier* get_modid();
......
......@@ -100,4 +100,10 @@ template Set t_set_template_lists(
template Uni t_uni(template integer p := ef_next_number()) := { i := p };
template Set.roi t_roi(integer p_val := 1, template integer p_temp := ef_next_number())
:= { p_val, p_temp };
template Set t_set_multi_layered(template Set.roi p := t_roi)
:= { soi1 := ?, soi2 := ?, roi := p };
}
......@@ -200,6 +200,23 @@ testcase tc_pard_def_encvalue_unichar_w_custom_encoding() runs on CT
}
}
testcase tc_pard_def_set_multi_layered() runs on CT
{
ef_reset();
var template Set temps[4] := { t_set_multi_layered, t_set_multi_layered(), t_set_multi_layered(-), t_set_multi_layered(p := -) };
var template Set exp_temps[4] := {
{ soi1 := ?, soi2 := ?, roi := { 1, 23 } },
{ soi1 := ?, soi2 := ?, roi := { 1, 23 } },
{ soi1 := ?, soi2 := ?, roi := { 1, 23 } },
{ soi1 := ?, soi2 := ?, roi := { 1, 23 } } };
if (log2str(temps) == log2str(exp_temps)) {
setverdict(pass);
}
else {
setverdict(fail, "Got: ", temps, ", expected: ", exp_temps);
}
}
control {
execute(tc_pard_def_int());
execute(tc_pard_def_int_expr());
......@@ -213,6 +230,7 @@ control {
execute(tc_pard_def_template_lists());
execute(tc_pard_def_encvalue_w_custom_encoding());
execute(tc_pard_def_encvalue_unichar_w_custom_encoding());
execute(tc_pard_def_set_multi_layered());
}
}
......@@ -198,6 +198,23 @@ testcase tc_pard_def_encvalue_unichar_w_custom_encoding() runs on CT
}
}
testcase tc_pard_def_set_multi_layered() runs on CT
{
ef_reset();
var template Set temps[4] := { t_set_multi_layered, t_set_multi_layered(), t_set_multi_layered(-), t_set_multi_layered(p := -) };
var template Set exp_temps[4] := {
{ soi1 := ?, soi2 := ?, roi := { 1, 1 } },
{ soi1 := ?, soi2 := ?, roi := { 1, 2 } },
{ soi1 := ?, soi2 := ?, roi := { 1, 3 } },
{ soi1 := ?, soi2 := ?, roi := { 1, 4 } } };
if (log2str(temps) == log2str(exp_temps)) {
setverdict(pass);
}
else {
setverdict(fail, "Got: ", temps, ", expected: ", exp_temps);
}
}
control {
execute(tc_pard_def_int());
execute(tc_pard_def_int_expr());
......@@ -211,6 +228,7 @@ control {
execute(tc_pard_def_template_lists());
execute(tc_pard_def_encvalue_w_custom_encoding());
execute(tc_pard_def_encvalue_unichar_w_custom_encoding());
execute(tc_pard_def_set_multi_layered());
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment