Skip to content

Commit

Permalink
Create setter procedures for opaque fields unconditionally
Browse files Browse the repository at this point in the history
The condition was a remnent of the differentiation between bounded and
unbounded opaque fields. Due to the changes for #356 this is not needed
anymore.
  • Loading branch information
treiher committed Jan 22, 2021
1 parent c545fa0 commit 7a18c71
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions rflx/generator/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ def specification(field: Field) -> ProcedureSpecification:
],
)
for f, t in message.types.items()
if isinstance(t, Opaque) and setter_required(message, f)
if isinstance(t, Opaque)
],
[
SubprogramBody(
Expand All @@ -630,7 +630,7 @@ def specification(field: Field) -> ProcedureSpecification:
],
)
for f, t in message.types.items()
if isinstance(t, Opaque) and setter_required(message, f)
if isinstance(t, Opaque)
],
)

Expand Down Expand Up @@ -697,7 +697,7 @@ def formal_parameters(field: Field) -> Sequence[FormalSubprogramDeclaration]:
formal_parameters(f),
)
for f, t in message.types.items()
if isinstance(t, Opaque) and setter_required(message, f)
if isinstance(t, Opaque)
],
[
SubprogramBody(
Expand All @@ -721,7 +721,7 @@ def formal_parameters(field: Field) -> Sequence[FormalSubprogramDeclaration]:
],
)
for f, t in message.types.items()
if isinstance(t, Opaque) and setter_required(message, f)
if isinstance(t, Opaque)
],
)

Expand Down Expand Up @@ -750,7 +750,7 @@ def specification(field: Field) -> ProcedureSpecification:
],
)
for f, t in message.types.items()
if isinstance(t, Opaque) and setter_required(message, f)
if isinstance(t, Opaque)
],
[
SubprogramBody(
Expand All @@ -759,7 +759,7 @@ def specification(field: Field) -> ProcedureSpecification:
common.initialize_field_statements(message, f, self.prefix),
)
for f, t in message.types.items()
if isinstance(t, Opaque) and setter_required(message, f)
if isinstance(t, Opaque)
],
)

Expand Down Expand Up @@ -912,11 +912,3 @@ def __field_byte_location_declarations() -> Sequence[Declaration]:
Call(const.TYPES_BYTE_INDEX, [Variable("Last")]),
),
]


def setter_required(message: Message, field: Field) -> bool:
return any(
True
for l in message.incoming(field)
if expr.Size("Message") not in l.size and expr.Last("Message") not in l.size
)

0 comments on commit 7a18c71

Please sign in to comment.