From afe471d8e6226d7bc362b9140939363b0c7c1c46 Mon Sep 17 00:00:00 2001 From: florianessl Date: Mon, 6 May 2024 17:59:36 +0200 Subject: [PATCH] Fixed issue in code generator: merging enums from two different files might overwrite existing declarations in some cases --- generator/generate.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/generator/generate.py b/generator/generate.py index f4c7484c..d8153956 100755 --- a/generator/generate.py +++ b/generator/generate.py @@ -312,7 +312,12 @@ def get_enums(*filenames): for k, v in merge_dicts(results).items(): new_result[k] = OrderedDict() for kk, gg in groupby(v, operator.attrgetter("entry")): - new_result[k][kk] = list(map(lambda x: (x.value, x.index), gg)) + list_of = list(map(lambda x: (x.value, x.index), gg)) + if kk in new_result[k]: + for elem in list_of: + new_result[k][kk].append(elem) + else: + new_result[k][kk] = list_of return new_result