From 5804a9a6103a8132d76f07872ec1511f31dd684d Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Wed, 30 Mar 2016 21:01:16 +0200 Subject: [PATCH] Refine the test for tabs so that it checks strings in lists too. --- lslopt/lslfoldconst.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lslopt/lslfoldconst.py b/lslopt/lslfoldconst.py index 639a5b4..12da7ef 100644 --- a/lslopt/lslfoldconst.py +++ b/lslopt/lslfoldconst.py @@ -944,8 +944,17 @@ class foldconst(object): event=self.CurEvent) else: value = fn(*tuple(arg['value'] for arg in child)) - if not self.foldtabs and isinstance(value, unicode) and '\t' in value: - 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']) + if not self.foldtabs: + 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 parent[index] = {'nt':'CONST', 't':node['t'], 'value':value} except lslfuncs.ELSLCantCompute: