Mark returned constant node as side effect-free.

When a function was successfully applied, the resulting constant node was not marked as side effect-free. This could potentially lead to poor optimization.
This commit is contained in:
Sei Lisa 2017-01-17 01:00:04 +01:00
parent 65d3f1130a
commit 13f3c951e1

View file

@ -1000,7 +1000,7 @@ class foldconst(object):
if self.warntabs:
warning(u"Can't optimize call to %s because it would generate a tab character (you can force the optimization with the 'foldtabs' option, or disable this warning by disabling the 'warntabs' option)." % node['name'].decode('utf8'))
return
parent[index] = {'nt':'CONST', 't':node['t'], 'value':value}
parent[index] = {'nt':'CONST', 't':node['t'], 'value':value, 'SEF':True}
elif node['name'] == 'llGetListLength':
# Convert llGetListLength(expr) to (expr != [])
node = {'nt':'CONST', 't':'list', 'value':[]}