Commit c87ec835 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

No division by 0 in type checks

parent 8e692deb
......@@ -1313,8 +1313,8 @@ def expression(root, context):
'Max': str(float(left.Max) - float(right.Max))}
expr.exprType = type('Minus', (basic,), attrs)
elif isinstance(expr, ogAST.ExprDiv):
attrs = {'Min': str(float(left.Min) / float(right.Min)),
'Max': str(float(left.Max) / float(right.Max))}
attrs = {'Min': str(float(left.Min) / (float(right.Min) or 1)),
'Max': str(float(left.Max) / (float(right.Max) or 1))}
expr.exprType = type('Div', (basic,), attrs)
elif isinstance(expr, (ogAST.ExprMod, ogAST.ExprRem)):
attrs = {'Min': right.Min, 'Max': right.Max}
......
TASTE-Dataview DEFINITIONS ::=
BEGIN
Int ::= INTEGER(-1000..1000)
Int ::= INTEGER(0..1000)
Bool ::= BOOLEAN
Float ::= REAL (-10000.0..10000.0)
Float ::= REAL (0..10000.0)
END
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment