From e2d01e78259df4f3079809e26139e5c316d5c682 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Mon, 19 Nov 2018 18:47:50 +0100 Subject: [PATCH] Extend the 1-element optimization of llDumpList2String to non-SEF first arg --- lslopt/lslfuncopt.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lslopt/lslfuncopt.py b/lslopt/lslfuncopt.py index d56670b..9a94c15 100644 --- a/lslopt/lslfuncopt.py +++ b/lslopt/lslfuncopt.py @@ -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'):