Commit 8bd0a1d0 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Cast integers at the right place

parent e4e62f2d
......@@ -142,6 +142,9 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
1.5.19 (11/2016)
- Fix integer cast in Ada
1.5.18 (11/2016)
- Fix parsing of ASN.1 constants that use an annonymous inner type
......
......@@ -1367,7 +1367,10 @@ def _prim_call(prim):
range_str = u"{}'Length".format(param_str)
else:
range_str = u"{}.Length".format(param_str)
ada_string += ('Integer({})'.format(range_str))
#ada_string += ('Integer({})'.format(range_str))
# I removed the cast here, because it is not the right place
# length fields are already Integers, no?
ada_string += range_str
elif ident == 'present':
# User wants to know what CHOICE element is present
exp = params[0]
......@@ -1606,6 +1609,9 @@ def _equality(expr):
basic = lbty.kind in ('IntegerType', 'Integer32Type', 'BooleanType',
'EnumeratedType', 'ChoiceEnumeratedType')
if basic:
if lbty.kind == 'IntegerType':
# Cast right side to make sure it is the same integer type as left
right_str = '{}({})'.format(actual_type, right_str)
ada_string = u'({left} {op} {right})'.format(
left=left_str, op=expr.operand, right=right_str)
else:
......
......@@ -138,7 +138,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '1.5.18'
__version__ = '1.5.19'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......
Supports Markdown
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