mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Add support for function calls in CompareTrees.
This commit is contained in:
parent
7ae7fa4396
commit
6ad2ef04d7
1 changed files with 9 additions and 2 deletions
|
@ -127,10 +127,17 @@ class foldconst(object):
|
|||
# They MUSt be SEF
|
||||
if 'SEF' not in node1 or 'SEF' not in node2:
|
||||
return False
|
||||
# So far it's only accepted if both are identifiers.
|
||||
# So far it's only accepted if both are identifiers or function calls,
|
||||
# recursively.
|
||||
return (node1['nt'] == node2['nt'] == 'IDENT'
|
||||
and node1['name'] == node2['name']
|
||||
and node1['scope'] == node2['scope'])
|
||||
and node1['scope'] == node2['scope']
|
||||
or node1['nt'] == node2['nt'] == 'FNCALL'
|
||||
and node1['name'] == node2['name']
|
||||
and all(self.CompareTrees(node1['ch'][i],
|
||||
node2['ch'][i])
|
||||
for i in xrange(len(node1['ch'])))
|
||||
)
|
||||
|
||||
def FoldStmt(self, parent, index):
|
||||
"""Simplify a statement."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue