about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--035call_ingredient.cc12
-rw-r--r--060string.mu2
2 files changed, 13 insertions, 1 deletions
diff --git a/035call_ingredient.cc b/035call_ingredient.cc
index 599906da..8daca0cf 100644
--- a/035call_ingredient.cc
+++ b/035call_ingredient.cc
@@ -50,6 +50,8 @@ case NEXT_INGREDIENT: {
     ++Current_routine->calls.front().next_ingredient_to_process;
   }
   else {
+    if (SIZE(current_instruction().products) < 2)
+      raise << current_recipe_name() << ": no ingredient to save in " << current_instruction().products.at(0).original_string << '\n' << end();
     products.resize(2);
     products.at(0).push_back(0);  // todo: will fail noisily if we try to read a compound value
     products.at(1).push_back(0);
@@ -57,6 +59,16 @@ case NEXT_INGREDIENT: {
   break;
 }
 
+:(scenario next_ingredient_warn_on_missing)
+% Hide_warnings = true;
+recipe main [
+  f
+]
+recipe f [
+  11:number <- next-ingredient
+]
++warn: f: no ingredient to save in 11:number
+
 :(scenario rewind_ingredients)
 recipe main [
   f 2
diff --git a/060string.mu b/060string.mu
index d2ad9c0a..854e27a9 100644
--- a/060string.mu
+++ b/060string.mu
@@ -413,7 +413,7 @@ recipe string-replace [
   s:address:array:character <- next-ingredient
   oldc:character <- next-ingredient
   newc:character <- next-ingredient
-  from:number <- next-ingredient
+  from:number, _ <- next-ingredient  # default to 0
   len:number <- length *s
   i:number <- find-next s, oldc, from
   done?:boolean <- greater-or-equal i, len