File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -343,12 +343,12 @@ void statement_list_typecheckt::typecheck_statement_list_networks(
343
343
if (tia_symbol.value .is_nil ())
344
344
tia_symbol.value = code_blockt{};
345
345
346
+ clear_module_state ();
346
347
typecheck_temp_var_decls (tia_module, tia_symbol);
347
348
348
349
for (const auto &network : tia_module.networks )
349
350
{
350
- // Set RLO to true each time a new network is entered (TIA behaviour).
351
- rlo_bit = true_exprt ();
351
+ clear_network_state ();
352
352
for (const auto &instruction : network.instructions )
353
353
typecheck_statement_list_instruction (instruction, tia_symbol);
354
354
}
@@ -1804,6 +1804,21 @@ void statement_list_typecheckt::initialize_bit_expression(const exprt &op)
1804
1804
rlo_bit = op;
1805
1805
}
1806
1806
1807
+ void statement_list_typecheckt::clear_network_state ()
1808
+ {
1809
+ rlo_bit = true_exprt{};
1810
+ fc_bit = false ;
1811
+ or_bit = false ;
1812
+ nesting_stack.clear ();
1813
+ }
1814
+
1815
+ void statement_list_typecheckt::clear_module_state ()
1816
+ {
1817
+ clear_network_state ();
1818
+ label_references.clear ();
1819
+ stl_labels.clear ();
1820
+ }
1821
+
1807
1822
void statement_list_typecheckt::save_rlo_state (symbolt &tia_element)
1808
1823
{
1809
1824
symbol_exprt temp_rlo{
Original file line number Diff line number Diff line change @@ -756,6 +756,16 @@ class statement_list_typecheckt : public typecheckt
756
756
// / \param op: Operand of the encountered instruction.
757
757
void initialize_bit_expression (const exprt &op);
758
758
759
+ // / Modifies the state of the typecheck to resemble the beginning of a new
760
+ // / module. All changes to the implicit typecheck fields are close to the
761
+ // / original TIA behaviour.
762
+ void clear_module_state ();
763
+
764
+ // / Modifies the state of the typecheck to resemble the beginning of a new
765
+ // / network. All changes to the implicit typecheck fields are close to the
766
+ // / original TIA behaviour.
767
+ void clear_network_state ();
768
+
759
769
// / Saves the current RLO bit to a temporary variable to prevent false
760
770
// / overrides when modifying boolean variables.
761
771
// / \param tia_element: Symbol representation of the TIA element.
You can’t perform that action at this time.
0 commit comments