@@ -126,19 +126,22 @@ codet character_refine_preprocesst::convert_compare(conversion_inputt &target)
126
126
127
127
128
128
// / Converts function call to an assignment of an expression corresponding to
129
- // / the java method Character.digit:(CI)I
129
+ // / the java method Character.digit:(CI)I. The function call has one character
130
+ // / argument and an optional integer radix argument. If the radix is not given
131
+ // / it is set to 36 by default.
130
132
// / \param target: a position in a goto program
133
+ // / \return code assigning the result of the Character.digit function to the
134
+ // / left-hand-side of the given target
131
135
codet character_refine_preprocesst::convert_digit_char (
132
136
conversion_inputt &target)
133
137
{
134
138
const code_function_callt &function_call=target;
135
- PRECONDITION (function_call.arguments ().size ()>=1 );
139
+ const std::size_t nb_args=function_call.arguments ().size ();
140
+ PRECONDITION (nb_args==1 || nb_args==2 );
136
141
const exprt &arg=function_call.arguments ()[0 ];
137
142
// If there is no radix argument we set it to 36 which is the maximum possible
138
143
const exprt &radix=
139
- function_call.arguments ().size ()>1 ?
140
- function_call.arguments ()[1 ]:
141
- from_integer (36 , arg.type ());
144
+ nb_args>1 ?function_call.arguments ()[1 ]:from_integer (36 , arg.type ());
142
145
const exprt &result=function_call.lhs ();
143
146
const typet &type=result.type ();
144
147
0 commit comments