Extend the 1-element optimization of llDumpList2String to non-SEF first arg
This commit is contained in:
@@ -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'):
|
||||
|
||||
Reference in New Issue
Block a user