Add "addstrings" option (disabled by default) to select whether to automatically concatenate strings during constant folding.

This commit is contained in:
Sei Lisa 2015-02-28 20:01:51 +01:00
parent 6ea01c4242
commit 8f83e2f1ab
3 changed files with 14 additions and 7 deletions

View file

@ -225,7 +225,8 @@ class foldconst(object):
op1 = lval['value']
op2 = rval['value']
if nt == '+':
result = lslfuncs.add(op1, op2)
if ltype != 'string' or rtype != 'string' or self.addstrings:
result = lslfuncs.add(op1, op2)
elif nt == '-':
result = lslfuncs.sub(op1, op2)
elif nt == '*':