mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
llDumpList2String: Always optimize SEF lists of 1 element
This commit is contained in:
parent
64c9c1db8b
commit
1ebd029931
1 changed files with 7 additions and 1 deletions
|
@ -169,6 +169,12 @@ def OptimizeFunc(self, parent, index):
|
|||
parent[index] = nr(nt='CONST', t='string', value=u'', SEF=True)
|
||||
return
|
||||
|
||||
if list_len == 1:
|
||||
# A single-element list can always be transformed regardless of
|
||||
# the presence of function calls
|
||||
parent[index] = CastDL2S(self, child[0], 0)
|
||||
return
|
||||
|
||||
# Only optimize if the second param is a very simple expression,
|
||||
# otherwise the sums can get large.
|
||||
if child[1].nt in ('CONST', 'IDENT'):
|
||||
|
@ -198,7 +204,7 @@ def OptimizeFunc(self, parent, index):
|
|||
else:
|
||||
# Optimize to a sum of strings, right-to-left
|
||||
i = list_len - 1
|
||||
newnode = CastDL2S(self,child[0], i)
|
||||
newnode = CastDL2S(self, child[0], i)
|
||||
while i > 0:
|
||||
i -= 1
|
||||
newnode = nr(nt='+', t='string', SEF=True,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue