Commit ce79cc40 authored by dbarbera's avatar dbarbera
Browse files

Added type checking in relational expressions

parent c91c7040
......@@ -131,6 +131,16 @@ type_name = lambda t: \
types = lambda: getattr(DV, 'types', {})
def is_numeric(ty):
''' Return true if a type is numeric '''
return find_basic_type(ty).kind in (
def sdl_to_asn1(sort):
Convert case insensitive type reference to the actual type as found
......@@ -1065,7 +1075,12 @@ def relational_expression(root, context):
''' Relational expression analysys '''
expr, errors, warnings = binary_expression(root, context)
# TODO: Check types
if root.type not in (lexer.EQ, lexer.NEQ):
for ty in (expr.left.exprType, expr.right.exprType):
if not is_numeric(ty):
'Operands in relational expressions must be numerical'))
expr.exprType = BOOLEAN
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