mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
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:
parent
d6162dfcf2
commit
d58217ad96
4 changed files with 24 additions and 1 deletions
|
@ -305,7 +305,7 @@ def OptimizeFunc(self, parent, index):
|
||||||
newnode = nr(nt='+', t='string', SEF=True,
|
newnode = nr(nt='+', t='string', SEF=True,
|
||||||
ch=[CastDL2S(self, child[0], i),
|
ch=[CastDL2S(self, child[0], i),
|
||||||
nr(nt='+', t='string', SEF=True,
|
nr(nt='+', t='string', SEF=True,
|
||||||
ch=[self.Cast(child[1], 'string'), newnode]
|
ch=[self.Cast(child[1], 'string').copy(), newnode]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
parent[index] = newnode
|
parent[index] = newnode
|
||||||
|
|
11
unit_tests/regression.suite/issue-23.lsl
Normal file
11
unit_tests/regression.suite/issue-23.lsl
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
default
|
||||||
|
{
|
||||||
|
state_entry()
|
||||||
|
{
|
||||||
|
string tmp0 = llGetScriptName();
|
||||||
|
list tmp1 = [llGetOwner(), llGetOwner()];
|
||||||
|
list tmp2 = [llGetScriptName(), llGetScriptName()];
|
||||||
|
string encoded = llDumpList2String([tmp0, llList2CSV(tmp1), "Hello", 123, llList2CSV(tmp2)], "|");
|
||||||
|
llOwnerSay(encoded);
|
||||||
|
}
|
||||||
|
}
|
11
unit_tests/regression.suite/issue-23.out
Normal file
11
unit_tests/regression.suite/issue-23.out
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
default
|
||||||
|
{
|
||||||
|
state_entry()
|
||||||
|
{
|
||||||
|
string tmp0 = llGetScriptName();
|
||||||
|
list tmp1 = (list)llGetOwner() + llGetOwner();
|
||||||
|
list tmp2 = (list)llGetScriptName() + llGetScriptName();
|
||||||
|
string encoded = tmp0 + ("|" + (llList2CSV(tmp1) + ("|Hello|123|" + llList2CSV(tmp2))));
|
||||||
|
llOwnerSay(encoded);
|
||||||
|
}
|
||||||
|
}
|
1
unit_tests/regression.suite/issue-23.run
Normal file
1
unit_tests/regression.suite/issue-23.run
Normal file
|
@ -0,0 +1 @@
|
||||||
|
./main.py -O addstrings -
|
Loading…
Add table
Add a link
Reference in a new issue