Fix llDumpList2String disaster with string addition

The node containing the separator was not being copied; if it was modified by a later optimization step, the modification propagated to all previous nodes that contained it, causing incorrect results.

Many thanks to @KrsityKu for reporting and providing a repro.

Fixes #23.
This commit is contained in:
Sei Lisa 2023-02-26 09:41:46 +01:00
parent d6162dfcf2
commit d58217ad96
4 changed files with 24 additions and 1 deletions

View file

@ -305,7 +305,7 @@ def OptimizeFunc(self, parent, index):
newnode = nr(nt='+', t='string', SEF=True,
ch=[CastDL2S(self, child[0], i),
nr(nt='+', t='string', SEF=True,
ch=[self.Cast(child[1], 'string'), newnode]
ch=[self.Cast(child[1], 'string').copy(), newnode]
)
])
parent[index] = newnode