From d3aa7910a1e3e20c7b3489811aa649fc9ff80c19 Mon Sep 17 00:00:00 2001 From: Olof Kindgren Date: Wed, 8 Jan 2025 13:25:46 +0100 Subject: [PATCH] Avoid reordering lists with use flags --- fusesoc/capi2/coredata.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/fusesoc/capi2/coredata.py b/fusesoc/capi2/coredata.py index 06e42cd5..295e80e9 100644 --- a/fusesoc/capi2/coredata.py +++ b/fusesoc/capi2/coredata.py @@ -43,22 +43,18 @@ def _expand_use(self, data, flags): if type(data) == list: remove = [] - append = [] - for i in data: + for idx, i in enumerate(data): if type(i) == str and len(i) > 0 and "?" in i: expanded = Exprs(i).expand(flags) if i != expanded: - remove.append(i) if len(expanded) > 0: - append.append(expanded) + data[idx] = expanded + else: + remove.append(idx) elif type(i) == dict or type(i) == list: self._expand_use(i, flags) - - for i in remove: - data.remove(i) - - for i in append: - data.append(i) + for i in reversed(remove): + data.pop(i) def _append_lists(self, data): if type(data) == list: