mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Extend the 1-element optimization of llDumpList2String to non-SEF first arg
This commit is contained in:
parent
d4bcafa1f7
commit
e2d01e7825
1 changed files with 7 additions and 7 deletions
|
@ -162,11 +162,17 @@ def OptimizeFunc(self, parent, index):
|
|||
del node.name
|
||||
return
|
||||
|
||||
list_len = self.GetListNodeLength(child[0])
|
||||
if list_len is not False and list_len == 1 and child[1].SEF:
|
||||
# A single-element list can always be transformed regardless of
|
||||
# the presence of function calls with side effects
|
||||
parent[index] = CastDL2S(self, child[0], 0)
|
||||
return
|
||||
|
||||
if node.SEF:
|
||||
# Attempt to convert the function call into a sum of strings when
|
||||
# possible and productive.
|
||||
|
||||
list_len = self.GetListNodeLength(child[0])
|
||||
if list_len is False:
|
||||
# Can't identify the length, which means we can't optimize.
|
||||
return
|
||||
|
@ -177,12 +183,6 @@ 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'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue