Add optimizer option 'listlength' to optimize llGetListLength.

llGetListLength(arg) was transformed to arg!=[] whenever constant folding was active. This option allows disabling that optimization.
This commit is contained in:
Sei Lisa 2017-01-25 19:22:36 +01:00
parent e8852ad124
commit f0c115f924
3 changed files with 5 additions and 2 deletions

View file

@ -1001,7 +1001,7 @@ class foldconst(object):
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, 'SEF':True}
elif node['name'] == 'llGetListLength':
elif self.optlistlength and node['name'] == 'llGetListLength':
# Convert llGetListLength(expr) to (expr != [])
node = {'nt':'CONST', 't':'list', 'value':[]}
parent[index] = node = {'nt':'!=', 't':'list', 'ch':[child[0], node]}