Enable foldtabs warning

This commit is contained in:
Sei Lisa 2014-07-28 17:39:35 +02:00
parent 538d9ab66e
commit a6b3a0946f
2 changed files with 6 additions and 1 deletions

View file

@ -196,6 +196,9 @@ class optimizer(object):
else: else:
# Call it # Call it
val = self.functions[code[2]][2](*tuple(x[2] for x in code[3])) val = self.functions[code[2]][2](*tuple(x[2] for x in code[3]))
if not self.foldtabs and isinstance(val, unicode) and '\t' in val:
warning('WARNING: Tab in function result and foldtabs option not used.')
return
code[:] = [CONSTANT, code[1], val] code[:] = [CONSTANT, code[1], val]
return return
@ -360,6 +363,8 @@ class optimizer(object):
if 'optimize' not in options: if 'optimize' not in options:
return return
self.foldtabs = 'foldtabs' in options
# TODO: Add option to handle local jumps properly. # TODO: Add option to handle local jumps properly.
self.functions = functions self.functions = functions

View file

@ -35,7 +35,7 @@ Options (* means not implemented):
directives like: # 123 "filename". directives like: # 123 "filename".
optimize Runs the optimizer. optimize Runs the optimizer.
optsigns Optimize signs and float as int. optsigns Optimize signs and float as int.
* foldtabs Tabs can't be copy-pasted, so they aren't optimized by foldtabs Tabs can't be copy-pasted, so they aren't optimized by
default. But with support from the viewer, they can be default. But with support from the viewer, they can be
folded too and make it to the uploaded source. This folded too and make it to the uploaded source. This
option overrides that check, enabling optimization of option overrides that check, enabling optimization of