mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Refine the test for tabs so that it checks strings in lists too.
This commit is contained in:
parent
7283842b3a
commit
5804a9a610
1 changed files with 11 additions and 2 deletions
|
@ -944,8 +944,17 @@ class foldconst(object):
|
||||||
event=self.CurEvent)
|
event=self.CurEvent)
|
||||||
else:
|
else:
|
||||||
value = fn(*tuple(arg['value'] for arg in child))
|
value = fn(*tuple(arg['value'] for arg in child))
|
||||||
if not self.foldtabs and isinstance(value, unicode) and '\t' in value:
|
if not self.foldtabs:
|
||||||
warning("Can't optimize call to %s because it would generate a tab character (you can force the optimization with the foldtabs option)." % node['name'])
|
generatesTabs = ( isinstance(value, unicode)
|
||||||
|
and '\t' in value
|
||||||
|
or type(value) == list
|
||||||
|
and any(isinstance(x, unicode)
|
||||||
|
and '\t' in x
|
||||||
|
for x in value
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if generatesTabs:
|
||||||
|
warning("Can't optimize call to %s because it would generate a tab character (you can force the optimization with the foldtabs option)." % node['name'])
|
||||||
return
|
return
|
||||||
parent[index] = {'nt':'CONST', 't':node['t'], 'value':value}
|
parent[index] = {'nt':'CONST', 't':node['t'], 'value':value}
|
||||||
except lslfuncs.ELSLCantCompute:
|
except lslfuncs.ELSLCantCompute:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue