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:
@@ -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]}
|
||||
|
||||
Reference in New Issue
Block a user