From 68cee02eb50fed661dd52941fdc99dc668fc21fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 19 Oct 2023 16:33:54 -0400
Subject: [PATCH] Bytecode: simplify
 Interpreter::check_for_controlled_exo_validity()

---
 mex/sources/bytecode/Interpreter.cc | 10 +++++-----
 mex/sources/bytecode/Interpreter.hh |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mex/sources/bytecode/Interpreter.cc b/mex/sources/bytecode/Interpreter.cc
index 7d653c5039..084faf17f3 100644
--- a/mex/sources/bytecode/Interpreter.cc
+++ b/mex/sources/bytecode/Interpreter.cc
@@ -635,7 +635,7 @@ Interpreter::simulate_a_block(const vector_table_conditional_local_type &vector_
 }
 
 void
-Interpreter::check_for_controlled_exo_validity(int current_block, const vector<s_plan> &sconstrained_extended_path)
+Interpreter::check_for_controlled_exo_validity(const vector<s_plan> &sconstrained_extended_path)
 {
   vector<int> exogenous {evaluator.getCurrentBlockExogenous()};
   vector<int> endogenous {evaluator.getCurrentBlockEndogenous()};
@@ -646,18 +646,18 @@ Interpreter::check_for_controlled_exo_validity(int current_block, const vector<s
         throw FatalException{"\nThe conditional forecast involving as constrained variable "
             + symbol_table.getName(SymbolType::endogenous, it.exo_num)
             + " and as endogenized exogenous " + symbol_table.getName(SymbolType::exogenous, it.var_num)
-            + " that do not appear in block=" + to_string(current_block+1)
+            + " that do not appear in block=" + to_string(block_num+1)
             + ")\nYou should not use block in model options"};
       else if (find(endogenous.begin(), endogenous.end(), it.exo_num) != endogenous.end()
                && find(exogenous.begin(), exogenous.end(), it.var_num) != exogenous.end()
                && (type == BlockSimulationType::evaluateForward
                    || type == BlockSimulationType::evaluateBackward))
         throw FatalException{"\nThe conditional forecast cannot be implemented for the block="
-            + to_string(current_block+1) + ") that has to be evaluated instead to be solved\nYou should not use block in model options"};
+            + to_string(block_num+1) + ") that has to be evaluated instead to be solved\nYou should not use block in model options"};
       else if (find(previous_block_exogenous.begin(), previous_block_exogenous.end(), it.var_num)
                != previous_block_exogenous.end())
         throw FatalException{"\nThe conditional forecast involves in the block "
-            + to_string(current_block+1) + " the endogenized exogenous "
+            + to_string(block_num+1) + " the endogenized exogenous "
             + symbol_table.getName(SymbolType::exogenous, it.var_num)
             + " that appear also in a previous block\nYou should not use block in model options"};
     }
@@ -712,7 +712,7 @@ Interpreter::MainLoop(const string &bin_basename, bool evaluate, int block, bool
       u_count_int = evaluator.getCurrentBlockUCount();
 
       if (constrained)
-        check_for_controlled_exo_validity(current_block, sconstrained_extended_path);
+        check_for_controlled_exo_validity(sconstrained_extended_path);
       if (print)
         {
           if (steady_state)
diff --git a/mex/sources/bytecode/Interpreter.hh b/mex/sources/bytecode/Interpreter.hh
index 31634188e8..9277557d1b 100644
--- a/mex/sources/bytecode/Interpreter.hh
+++ b/mex/sources/bytecode/Interpreter.hh
@@ -165,7 +165,7 @@ private:
   void evaluate_a_block(bool initialization, bool single_block, const string &bin_base_name);
   int simulate_a_block(const vector_table_conditional_local_type &vector_table_conditional_local, bool single_block, const string &bin_base_name);
   static string elastic(string str, unsigned int len, bool left);
-  void check_for_controlled_exo_validity(int current_block, const vector<s_plan> &sconstrained_extended_path);
+  void check_for_controlled_exo_validity(const vector<s_plan> &sconstrained_extended_path);
   pair<bool, vector<int>> MainLoop(const string &bin_basename, bool evaluate, int block, bool constrained, const vector<s_plan> &sconstrained_extended_path, const vector_table_conditional_local_type &vector_table_conditional_local);
   void Simulate_Newton_Two_Boundaries(int blck, int y_size, int y_kmin, int y_kmax, int Size, int periods, bool cvg, int minimal_solving_periods, int stack_solve_algo, const vector_table_conditional_local_type &vector_table_conditional_local);
   void Simulate_Newton_One_Boundary(bool forward);
-- 
GitLab