about summary refs log tree commit diff stats
path: root/cpp/035call
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/035call')
-rw-r--r--cpp/035call10
1 files changed, 7 insertions, 3 deletions
diff --git a/cpp/035call b/cpp/035call
index c7052e62..799cb739 100644
--- a/cpp/035call
+++ b/cpp/035call
@@ -65,15 +65,19 @@ inline string recipe_name() {
 inline vector<instruction>& steps() {
   return Recipe[Current_routine->calls.top().running_recipe].steps;
 }
+:(replace{} "inline const instruction& current_instruction()")
+inline const instruction& current_instruction() {
+  return Recipe[Current_routine->calls.top().running_recipe].steps[Current_routine->calls.top().pc];
+}
 
 :(replace{} "default:" following "End Primitive Recipe Implementations")
 default: {
   // not a primitive; try to look up the book of recipes
-  if (Recipe.find(instructions[pc].operation) == Recipe.end()) {
-    raise << "undefined operation " << instructions[pc].operation << ": " << instructions[pc].name << '\n';
+  if (Recipe.find(current_instruction().operation) == Recipe.end()) {
+    raise << "undefined operation " << current_instruction().operation << ": " << current_instruction().name << '\n';
     break;
   }
-  Current_routine->calls.push(call(instructions[pc].operation));
+  Current_routine->calls.push(call(current_instruction().operation));
   continue;  // not done with caller; don't increment pc
 }