Fix functions with side effects being erroneously optimized.

The function's SEF status was not taken into account when substituting functions with their values. This affected llModPow and llXorBase64Strings, both of which have a delay, and were erroneously substituted.

But allow them to be substituted when in calculator mode.
This commit is contained in:
Sei Lisa 2017-01-08 05:53:10 +01:00
parent 8b9fe7693e
commit 3afd961cf7

View file

@ -946,8 +946,9 @@ class foldconst(object):
sym = self.symtab[0][node['name']]
OptimizeParams(node, sym)
if 'Fn' in sym:
# Guaranteed to be side-effect free if the children are.
if 'Fn' in sym and ('SEF' in sym and sym['SEF'] or lslcommon.IsCalc):
# It's side-effect free if the children are and the function
# is marked as SEF.
if SEFargs:
node['SEF'] = True
if CONSTargs: