Skip to content
Snippets Groups Projects
Commit 5952fc78 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Fixed 'implicit omit' inside optional fields that are present (issue #588)


Signed-off-by: default avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 0ad46c84
No related branches found
No related tags found
8 merge requests!258OOP: classes embedded in structures - part 1 (issue #601),!243OOP: added semantic checks for overriding/shadowing object methods (issue #596),!242OOP: updated presence checking operators and object methods (issue #596),!241OOP: fixed super-constructor call parameter code generation for structured values and templates (issue #591),!239Fixed an issue with the parameter default value location change (issue #581),!238OOP: fixed name clash in the constructor and improved previous modifications...,!237Made location information for parameter default value assignments more accurate (issue #581),!236Fixed 'implicit omit' inside optional fields that are present (issue #588)
......@@ -364,6 +364,8 @@ public:
* Redirects the call to the optional value. */
virtual void remove_refd_index(int index);
#endif
void set_implicit_omit();
};
#if HAVE_GCC(4,6)
......@@ -1311,6 +1313,14 @@ int OPTIONAL<T_type>::TEXT_decode(const TTCN_Typedescriptor_t& p_td,
#endif
template<typename T_type>
void OPTIONAL<T_type>::set_implicit_omit()
{
if (is_present()) {
optional_value->set_implicit_omit();
}
}
#if defined(__GNUC__) && __GNUC__ >= 3
/** Note: These functions allow most efficient operation by passing the left
* operand OMIT_VALUE as value instead of constant reference.
......
......@@ -30,6 +30,7 @@ mrecof1 := { [1] := { c := "clinton" } }
msetof1 := { [1] := { c := "clinton" } }
mrecof2 := { [1] := { mr2 := { c := "clinton" } } }
msetof2 := { [1] := { ms2 := { c := "clinton" } } }
mp_emb_opt := { m := { a := 2 } }
[EXECUTE]
io.control
......
......@@ -37,6 +37,10 @@ type record MyRecord2 {
MyRecord1 m
}
type record MyRecord3 {
MyRecord1 m optional
}
type set MySet2 {
MySet1 m
}
......@@ -562,6 +566,29 @@ testcase tc_io_asn_record_empty() runs on O
else { setverdict(fail, t_asn_rec_empty); }
}
// Implicit omit for fields of records embedded in an optional field of another record
const MyRecord3 c_emb_opt := { m := { a := 2 } }
with { optional "implicit omit" }
template MyRecord3 t_emb_opt := { m := { a := ? } }
with { optional "implicit omit" }
modulepar MyRecord3 mp_emb_opt
with { optional "implicit omit" }
testcase tc_io_embedded_optional() runs on O {
if (not isbound(c_emb_opt) or c_emb_opt.m.b != omit) {
setverdict(fail, "c_emb_opt: ", c_emb_opt);
}
if (not isbound(t_emb_opt) or log2str(t_emb_opt.m.b) != "omit") {
setverdict(fail, "t_emb_opt: ", t_emb_opt);
}
if (not isbound(mp_emb_opt) or mp_emb_opt.m.b != omit) {
setverdict(fail, "c_emb_opt: ", mp_emb_opt);
}
setverdict(pass);
}
control {
execute(tc12());
execute(tc1ab());
......@@ -605,6 +632,7 @@ execute(tc_HQ30261())
execute(tc_io_embedded());
execute(tc_io_notused());
execute(tc_io_asn_record_empty());
execute(tc_io_embedded_optional());
}
with {
optional "implicit omit"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment