File tree 1 file changed +10
-10
lines changed
1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -195,9 +195,15 @@ std::string expr2javat::convert_constant(
195
195
const constant_exprt &src,
196
196
unsigned &precedence)
197
197
{
198
- if (src.type ().id ()==ID_bool)
198
+ if (src.type ().id ()==ID_c_bool)
199
+ {
200
+ if (!src.is_zero ())
201
+ return " true" ;
202
+ else
203
+ return " false" ;
204
+ }
205
+ else if (src.type ().id ()==ID_bool)
199
206
{
200
- // Java has built-in Boolean constants, in contrast to C
201
207
if (src.is_true ())
202
208
return " true" ;
203
209
else if (src.is_false ())
@@ -482,7 +488,6 @@ std::string expr2javat::convert(
482
488
const exprt &src,
483
489
unsigned &precedence)
484
490
{
485
- const typet &type=ns.follow (src.type ());
486
491
if (src.id ()==" java-this" )
487
492
return convert_java_this (src, precedence=15 );
488
493
if (src.id ()==ID_java_instanceof)
@@ -510,13 +515,8 @@ std::string expr2javat::convert(
510
515
}
511
516
else if (src.id ()==ID_java_string_literal)
512
517
return ' "' +MetaString (src.get_string (ID_value))+' "' ;
513
- else if (src.id ()==ID_constant && (type.id ()==ID_bool || type.id ()==ID_c_bool))
514
- {
515
- if (src.is_true ())
516
- return " true" ;
517
- else
518
- return " false" ;
519
- }
518
+ else if (src.id ()==ID_constant)
519
+ return convert_constant (to_constant_expr (src), precedence=16 );
520
520
else
521
521
return expr2ct::convert (src, precedence);
522
522
}
You can’t perform that action at this time.
0 commit comments