mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Use CompareTrees to optimize the == operator.
Now we can.
This commit is contained in:
parent
e6b23a2d7a
commit
dc117c2cbf
1 changed files with 5 additions and 9 deletions
|
@ -1084,15 +1084,11 @@ class foldconst(object):
|
|||
del child
|
||||
self.FoldTree(parent, index)
|
||||
return
|
||||
# While this is tempting, it can only be done for identifiers.
|
||||
# Counterexample: llFrand(1) == llFrand(1) would
|
||||
# almost always return FALSE. After CompareTrees is fixed,
|
||||
# we can reinstate it.
|
||||
#if self.CompareTrees(child[0], child[1]):
|
||||
# # a == a -> 1
|
||||
# parent[index] = {'nt':'CONST', 't':'integer', 'value':1,
|
||||
# 'SEF':True}
|
||||
# return
|
||||
if self.CompareTrees(child[0], child[1]):
|
||||
# a == a -> 1
|
||||
parent[index] = {'nt':'CONST', 't':'integer', 'value':1,
|
||||
'SEF':True}
|
||||
return
|
||||
return
|
||||
|
||||
if nt in ('<=', '>=') or nt == '!=' and child[0]['t'] != 'list':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue