@@ -117,7 +117,7 @@ void jsil_typecheckt::make_type_compatible(
117
117
if (type.id ().empty () || type.is_nil ())
118
118
{
119
119
err_location (expr);
120
- str << " make_type_compatible got empty type: " << expr.pretty ();
120
+ error () << " make_type_compatible got empty type: " << expr.pretty () << eom ;
121
121
throw 0 ;
122
122
}
123
123
@@ -133,10 +133,10 @@ void jsil_typecheckt::make_type_compatible(
133
133
if (jsil_incompatible_types (expr.type (), type))
134
134
{
135
135
err_location (expr);
136
- str << " failed to typecheck expr "
137
- << expr.pretty () << " with type "
138
- << expr.type ().pretty ()
139
- << " ; required type " << type.pretty ();
136
+ error () << " failed to typecheck expr "
137
+ << expr.pretty () << " with type "
138
+ << expr.type ().pretty ()
139
+ << " ; required type " << type.pretty () << eom ;
140
140
throw 0 ;
141
141
}
142
142
}
@@ -190,8 +190,8 @@ void jsil_typecheckt::typecheck_type(typet &type)
190
190
191
191
if (symbol_table.add (new_symbol))
192
192
{
193
- str << " failed to add parameter symbol `"
194
- << new_symbol.name << " ' in the symbol table" ;
193
+ error () << " failed to add parameter symbol `"
194
+ << new_symbol.name << " ' in the symbol table" << eom ;
195
195
throw 0 ;
196
196
}
197
197
}
@@ -254,7 +254,7 @@ void jsil_typecheckt::typecheck_expr_main(exprt &expr)
254
254
if (expr.id ()==ID_code)
255
255
{
256
256
err_location (expr);
257
- str << " typecheck_expr_main got code: " << expr.pretty ();
257
+ error () << " typecheck_expr_main got code: " << expr.pretty () << eom ;
258
258
throw 0 ;
259
259
}
260
260
else if (expr.id ()==ID_symbol)
@@ -359,7 +359,7 @@ void jsil_typecheckt::typecheck_expr_main(exprt &expr)
359
359
else
360
360
{
361
361
err_location (expr);
362
- str << " unexpected expression: " << expr.pretty ();
362
+ error () << " unexpected expression: " << expr.pretty () << eom ;
363
363
throw 0 ;
364
364
}
365
365
}
@@ -425,7 +425,8 @@ void jsil_typecheckt::typecheck_expr_proto_field(exprt &expr)
425
425
if (expr.operands ().size ()!=2 )
426
426
{
427
427
err_location (expr);
428
- str << " operator `" << expr.id () << " ' expects two operands" ;
428
+ error () << " operator `" << expr.id ()
429
+ << " ' expects two operands" << eom;
429
430
throw 0 ;
430
431
}
431
432
@@ -452,7 +453,8 @@ void jsil_typecheckt::typecheck_expr_proto_obj(exprt &expr)
452
453
if (expr.operands ().size ()!=2 )
453
454
{
454
455
err_location (expr);
455
- str << " operator `" << expr.id () << " ' expects two operands" ;
456
+ error () << " operator `" << expr.id ()
457
+ << " ' expects two operands" ;
456
458
throw 0 ;
457
459
}
458
460
@@ -479,7 +481,8 @@ void jsil_typecheckt::typecheck_expr_delete(exprt &expr)
479
481
if (expr.operands ().size ()!=2 )
480
482
{
481
483
err_location (expr);
482
- str << " operator `" << expr.id () << " ' expects two operands" ;
484
+ error () << " operator `" << expr.id ()
485
+ << " ' expects two operands" << eom;
483
486
throw 0 ;
484
487
}
485
488
@@ -506,7 +509,8 @@ void jsil_typecheckt::typecheck_expr_index(exprt &expr)
506
509
if (expr.operands ().size ()!=2 )
507
510
{
508
511
err_location (expr);
509
- str << " operator `" << expr.id () << " ' expects two operands" ;
512
+ error () << " operator `" << expr.id ()
513
+ << " ' expects two operands" << eom;
510
514
throw 0 ;
511
515
}
512
516
@@ -537,7 +541,8 @@ void jsil_typecheckt::typecheck_expr_has_field(exprt &expr)
537
541
if (expr.operands ().size ()!=2 )
538
542
{
539
543
err_location (expr);
540
- str << " operator `" << expr.id () << " ' expects two operands" ;
544
+ error () << " operator `" << expr.id ()
545
+ << " ' expects two operands" << eom;
541
546
throw 0 ;
542
547
}
543
548
@@ -564,7 +569,8 @@ void jsil_typecheckt::typecheck_expr_field(exprt &expr)
564
569
if (expr.operands ().size ()!=1 )
565
570
{
566
571
err_location (expr);
567
- str << " operator `" << expr.id () << " ' expects single operand" ;
572
+ error () << " operator `" << expr.id ()
573
+ << " ' expects single operand" << eom;
568
574
throw 0 ;
569
575
}
570
576
@@ -590,7 +596,8 @@ void jsil_typecheckt::typecheck_expr_base(exprt &expr)
590
596
if (expr.operands ().size ()!=1 )
591
597
{
592
598
err_location (expr);
593
- str << " operator `" << expr.id () << " ' expects single operand" ;
599
+ error () << " operator `" << expr.id ()
600
+ << " ' expects single operand" << eom;
594
601
throw 0 ;
595
602
}
596
603
@@ -616,7 +623,8 @@ void jsil_typecheckt::typecheck_expr_ref(exprt &expr)
616
623
if (expr.operands ().size ()!=3 )
617
624
{
618
625
err_location (expr);
619
- str << " operator `" << expr.id () << " ' expects three operands" ;
626
+ error () << " operator `" << expr.id ()
627
+ << " ' expects three operands" << eom;
620
628
throw 0 ;
621
629
}
622
630
@@ -633,9 +641,9 @@ void jsil_typecheckt::typecheck_expr_ref(exprt &expr)
633
641
else
634
642
{
635
643
err_location (expr);
636
- str << " operator `" << expr.id ()
637
- << " ' expects reference type in the third parameter. Got:"
638
- << operand3.pretty ();
644
+ error () << " operator `" << expr.id ()
645
+ << " ' expects reference type in the third parameter. Got:"
646
+ << operand3.pretty () << eom ;
639
647
throw 0 ;
640
648
}
641
649
}
@@ -657,7 +665,8 @@ void jsil_typecheckt::typecheck_expr_concatenation(exprt &expr)
657
665
if (expr.operands ().size ()!=2 )
658
666
{
659
667
err_location (expr);
660
- str << " operator `" << expr.id () << " ' expects two operands" ;
668
+ error () << " operator `" << expr.id ()
669
+ << " ' expects two operands" << eom;
661
670
throw 0 ;
662
671
}
663
672
@@ -684,7 +693,8 @@ void jsil_typecheckt::typecheck_expr_subtype(exprt &expr)
684
693
if (expr.operands ().size ()!=2 )
685
694
{
686
695
err_location (expr);
687
- str << " operator `" << expr.id () << " ' expects two operands" ;
696
+ error () << " operator `" << expr.id ()
697
+ << " ' expects two operands" << eom;
688
698
throw 0 ;
689
699
}
690
700
@@ -711,7 +721,8 @@ void jsil_typecheckt::typecheck_expr_binary_boolean(exprt &expr)
711
721
if (expr.operands ().size ()!=2 )
712
722
{
713
723
err_location (expr);
714
- str << " operator `" << expr.id () << " ' expects two operands" ;
724
+ error () << " operator `" << expr.id ()
725
+ << " ' expects two operands" << eom;
715
726
throw 0 ;
716
727
}
717
728
@@ -738,7 +749,8 @@ void jsil_typecheckt::typecheck_expr_binary_arith(exprt &expr)
738
749
if (expr.operands ().size ()!=2 )
739
750
{
740
751
err_location (expr);
741
- str << " operator `" << expr.id () << " ' expects two operands" ;
752
+ error () << " operator `" << expr.id ()
753
+ << " ' expects two operands" << eom;
742
754
throw 0 ;
743
755
}
744
756
@@ -766,7 +778,8 @@ void jsil_typecheckt::typecheck_exp_binary_equal(exprt &expr)
766
778
if (expr.operands ().size ()!=2 )
767
779
{
768
780
err_location (expr);
769
- str << " operator `" << expr.id () << " ' expects two operands" ;
781
+ error () << " operator `" << expr.id ()
782
+ << " ' expects two operands" << eom;
770
783
throw 0 ;
771
784
}
772
785
@@ -792,7 +805,8 @@ void jsil_typecheckt::typecheck_expr_binary_compare(exprt &expr)
792
805
if (expr.operands ().size ()!=2 )
793
806
{
794
807
err_location (expr);
795
- str << " operator `" << expr.id () << " ' expects two operands" ;
808
+ error () << " operator `" << expr.id ()
809
+ << " ' expects two operands" << eom;
796
810
throw 0 ;
797
811
}
798
812
@@ -819,7 +833,8 @@ void jsil_typecheckt::typecheck_expr_unary_boolean(exprt &expr)
819
833
if (expr.operands ().size ()!=1 )
820
834
{
821
835
err_location (expr);
822
- str << " operator `" << expr.id () << " ' expects one operand" ;
836
+ error () << " operator `" << expr.id ()
837
+ << " ' expects one operand" << eom;
823
838
throw 0 ;
824
839
}
825
840
@@ -845,7 +860,8 @@ void jsil_typecheckt::typecheck_expr_unary_string(exprt &expr)
845
860
if (expr.operands ().size ()!=1 )
846
861
{
847
862
err_location (expr);
848
- str << " operator `" << expr.id () << " ' expects one operand" ;
863
+ error () << " operator `" << expr.id ()
864
+ << " ' expects one operand" << eom;
849
865
throw 0 ;
850
866
}
851
867
@@ -871,7 +887,8 @@ void jsil_typecheckt::typecheck_expr_unary_num(exprt &expr)
871
887
if (expr.operands ().size ()!=1 )
872
888
{
873
889
err_location (expr);
874
- str << " operator `" << expr.id () << " ' expects one operand" ;
890
+ error () << " operator `" << expr.id ()
891
+ << " ' expects one operand" << eom;
875
892
throw 0 ;
876
893
}
877
894
@@ -946,8 +963,9 @@ void jsil_typecheckt::typecheck_symbol_expr(symbol_exprt &symbol_expr)
946
963
947
964
if (symbol_table.add (new_symbol))
948
965
{
949
- str << " failed to add symbol `"
950
- << new_symbol.name << " ' in the symbol table" ;
966
+ error () << " failed to add symbol `"
967
+ << new_symbol.name << " ' in the symbol table"
968
+ << eom;
951
969
throw 0 ;
952
970
}
953
971
}
@@ -1014,7 +1032,7 @@ void jsil_typecheckt::typecheck_code(codet &code)
1014
1032
else
1015
1033
{
1016
1034
err_location (code);
1017
- str << " unexpected statement: " << statement;
1035
+ error () << " unexpected statement: " << statement << eom ;
1018
1036
throw 0 ;
1019
1037
}
1020
1038
}
@@ -1363,19 +1381,17 @@ bool jsil_typecheck(
1363
1381
1364
1382
catch (int e)
1365
1383
{
1366
- jsil_typecheck.error_msg ();
1384
+ jsil_typecheck.error ();
1367
1385
}
1368
1386
1369
1387
catch (const char *e)
1370
1388
{
1371
- jsil_typecheck.str << e;
1372
- jsil_typecheck.error_msg ();
1389
+ jsil_typecheck.error () << e << messaget::eom;
1373
1390
}
1374
1391
1375
1392
catch (const std::string &e)
1376
1393
{
1377
- jsil_typecheck.str << e;
1378
- jsil_typecheck.error_msg ();
1394
+ jsil_typecheck.error () << e << messaget::eom;
1379
1395
}
1380
1396
1381
1397
return jsil_typecheck.get_error_found ();
0 commit comments