about summary refs log tree commit diff stats
path: root/020run.cc
diff options
context:
space:
mode:
Diffstat (limited to '020run.cc')
-rw-r--r--020run.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/020run.cc b/020run.cc
index e60e75ac..8f27c820 100644
--- a/020run.cc
+++ b/020run.cc
@@ -57,8 +57,7 @@ void run(recipe_ordinal r) {
 }
 
 void run_current_routine() {
-  while (!Current_routine->completed())  // later layers will modify condition
-  {
+  while (should_continue_running(Current_routine)) {  // beware: later layers modify Current_routine here
     // Running One Instruction
     if (current_instruction().is_label) { ++current_step_index(); continue; }
     trace(Initial_callstack_depth + Trace_stream->callstack_depth, "run") << to_string(current_instruction()) << end();
@@ -101,6 +100,11 @@ void run_current_routine() {
   stop_running_current_routine:;
 }
 
+bool should_continue_running(const routine* current_routine) {
+  assert(current_routine == Current_routine);  // argument passed in just to make caller readable above
+  return !Current_routine->completed();
+}
+
 bool should_copy_ingredients() {
   // End should_copy_ingredients Special-cases
   return true;