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.
This commit is contained in:
Sei Lisa 2017-10-21 11:31:53 +02:00
parent ea9711642c
commit 923309e4a1

View file

@ -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