Use CompareTrees to optimize the == operator.
Now we can.
This commit is contained in:
@@ -1084,15 +1084,11 @@ class foldconst(object):
|
|||||||
del child
|
del child
|
||||||
self.FoldTree(parent, index)
|
self.FoldTree(parent, index)
|
||||||
return
|
return
|
||||||
# While this is tempting, it can only be done for identifiers.
|
if self.CompareTrees(child[0], child[1]):
|
||||||
# Counterexample: llFrand(1) == llFrand(1) would
|
# a == a -> 1
|
||||||
# almost always return FALSE. After CompareTrees is fixed,
|
parent[index] = {'nt':'CONST', 't':'integer', 'value':1,
|
||||||
# we can reinstate it.
|
'SEF':True}
|
||||||
#if self.CompareTrees(child[0], child[1]):
|
return
|
||||||
# # a == a -> 1
|
|
||||||
# parent[index] = {'nt':'CONST', 't':'integer', 'value':1,
|
|
||||||
# 'SEF':True}
|
|
||||||
# return
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if nt in ('<=', '>=') or nt == '!=' and child[0]['t'] != 'list':
|
if nt in ('<=', '>=') or nt == '!=' and child[0]['t'] != 'list':
|
||||||
|
|||||||
Reference in New Issue
Block a user