mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Optimize llDeleteSubList(expr, 0, -1) to [] if expr is SEF
It also applies to llListReplaceList with [] as replacement.
This commit is contained in:
parent
a6a08fe3f3
commit
0a7e2a9e1d
1 changed files with 13 additions and 0 deletions
|
@ -308,6 +308,19 @@ def OptimizeFunc(self, parent, index):
|
||||||
child[2] = {'nt':'CONST','t':'list','value':[],'SEF':True}
|
child[2] = {'nt':'CONST','t':'list','value':[],'SEF':True}
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if (name == 'llDeleteSubList'
|
||||||
|
or name == 'llListReplaceList' and child[1]['nt'] == 'CONST'
|
||||||
|
and not child[1]['value']
|
||||||
|
):
|
||||||
|
# llDeleteSubList(x, 0, -1) -> [] if x is SEF
|
||||||
|
# llListReplaceList(x, [], 0, -1) -> [] if x is SEF
|
||||||
|
if ('SEF' in child[0]
|
||||||
|
and child[-2]['nt'] == 'CONST' and child[-1]['nt'] == 'CONST'
|
||||||
|
and child[-2]['value'] == 0 and child[-1]['value'] == -1
|
||||||
|
):
|
||||||
|
parent[index] = {'nt':'CONST','SEF':True,'t':'list','value':[]}
|
||||||
|
return
|
||||||
|
|
||||||
def FuncOptSetup():
|
def FuncOptSetup():
|
||||||
# Patch the default values list for LSO
|
# Patch the default values list for LSO
|
||||||
if lslcommon.LSO:
|
if lslcommon.LSO:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue