about summary refs log tree commit diff stats
path: root/035call_ingredient.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-09-18 17:21:28 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-09-18 17:21:28 -0700
commit3e849f112bbbbd7d3b2e03d06aff935de04368c2 (patch)
treeed0cab4855f85219f1bab3b6b52218ca740a69ec /035call_ingredient.cc
parent064813d9b7d7ad4d13779a0e3282e00b747372e3 (diff)
downloadmu-3e849f112bbbbd7d3b2e03d06aff935de04368c2.tar.gz
2205 - warn on missing ingredient
..unless you explicitly ignore the found? result.
Diffstat (limited to '035call_ingredient.cc')
-rw-r--r--035call_ingredient.cc12
1 files changed, 12 insertions, 0 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