Commit dbe0d376 authored by Maxime Perrotin's avatar Maxime Perrotin

Fix underscore/dash issue

parent b06afd50
...@@ -1678,12 +1678,13 @@ def _prim_call(prim, **kwargs): ...@@ -1678,12 +1678,13 @@ def _prim_call(prim, **kwargs):
has_unsigned = True has_unsigned = True
need_cast = has_signed and has_unsigned need_cast = has_signed and has_unsigned
for child_name, descr in sort.Children.viewitems(): for child_name, descr in sort.Children.viewitems():
child_name_ada = child_name.replace('-', '_')
child_id = descr.EnumID child_id = descr.EnumID
child_sort = find_basic_type(descr.type) child_sort = find_basic_type(descr.type)
if not child_sort.kind.startswith('Integer'): if not child_sort.kind.startswith('Integer'):
need_default = True need_default = True
continue continue
set_value = '{var}.{name}'.format(var=varstr, name=child_name) set_value = '{var}.{name}'.format(var=varstr, name=child_name_ada)
if need_cast and float(child_sort.Min) >= 0.0: if need_cast and float(child_sort.Min) >= 0.0:
set_value = 'Asn1Int({})'.format(set_value) set_value = 'Asn1Int({})'.format(set_value)
choices.append(u'when {child_id} => {set_value}' choices.append(u'when {child_id} => {set_value}'
......
...@@ -30,7 +30,8 @@ MyInt ::= INTEGER (-10..10) ...@@ -30,7 +30,8 @@ MyInt ::= INTEGER (-10..10)
Parameters ::= CHOICE { Parameters ::= CHOICE {
one INTEGER (0..255), one INTEGER (0..255),
two MyInt, two MyInt,
three BOOLEAN three BOOLEAN,
four-ty-to MyInt
} }
......
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