Skip to content

Commit

Permalink
Use ordered dict for arrays in default instances
Browse files Browse the repository at this point in the history
Close #536
  • Loading branch information
Alexander Senier committed Jan 2, 2021
1 parent c19a174 commit 79bb58f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions rflx/generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2301,14 +2301,16 @@ def __create_message_unit(self, message: Message) -> None:
WithClause(self.__prefix * const.TYPES_PACKAGE),
]

arrays = [
self.__prefix * ID(t.identifier) for t in message.types.values() if isinstance(t, Array)
]
arrays = {
self.__prefix * ID(t.identifier): None
for t in message.types.values()
if isinstance(t, Array)
}
context.extend(WithClause(array) for array in arrays)
instantiation = GenericPackageInstantiation(
self.__prefix * ID(message.identifier),
name,
[self.__prefix * const.TYPES_PACKAGE] + arrays,
[self.__prefix * const.TYPES_PACKAGE] + list(arrays.keys()),
)

self.__create_instantiation_unit(ID(message.identifier), context, instantiation)
Expand Down

0 comments on commit 79bb58f

Please sign in to comment.