From 923309e4a13488029a9919ab2a7fea0e1b342f16 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Sat, 21 Oct 2017 11:31:53 +0200 Subject: [PATCH] Refine test for min and max. We had dormant code to check for boolean-ness of functions, which is now active. But it didn't cover all possible booleans. Now it does. An idea for the future is to associate ranges to expressions, and attach them to calculable functions. For example, (integer)llFrand(2) could be resolved to a boolean. --- lslopt/lslfoldconst.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lslopt/lslfoldconst.py b/lslopt/lslfoldconst.py index 6353083..1c10f66 100644 --- a/lslopt/lslfoldconst.py +++ b/lslopt/lslfoldconst.py @@ -238,7 +238,7 @@ class foldconst(object): if nt == 'FNCALL': sym = self.symtab[0][node['name']] if sym['Type'] == 'integer' and 'min' in sym and 'max' in sym \ - and sym['min'] == 0 and sym['max'] == 1: + and sym['min'] >= 0 and sym['max'] <= 1: return True return False