about summary refs log tree commit diff stats
path: root/040brace.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-11-10 10:34:16 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-11-10 10:34:16 -0800
commitc8f2ff13929c7204dec46b266fa0b155e6faca12 (patch)
treeb5e293493192c0829e0e381d195e6cace33784fc /040brace.cc
parentf116818c7c6e98a5d9bfa7058096b42df85d8e1c (diff)
downloadmu-c8f2ff13929c7204dec46b266fa0b155e6faca12.tar.gz
3657 - better error message
Thanks Ella Couch for reporting this.
Diffstat (limited to '040brace.cc')
-rw-r--r--040brace.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/040brace.cc b/040brace.cc
index 75877dca..4a6bfd10 100644
--- a/040brace.cc
+++ b/040brace.cc
@@ -392,7 +392,7 @@ def test1 [
 //   ```
 if (curr.name == "return-if" || curr.name == "reply-if") {
   if (curr.products.empty()) {
-    emit_return_block(result, "break-unless", curr.ingredients);
+    emit_return_block(result, "break-unless", curr);
     curr.clear();
   }
   else {
@@ -408,7 +408,7 @@ if (curr.name == "return-if" || curr.name == "reply-if") {
 //   ```
 if (curr.name == "return-unless" || curr.name == "reply-unless") {
   if (curr.products.empty()) {
-    emit_return_block(result, "break-if", curr.ingredients);
+    emit_return_block(result, "break-if", curr);
     curr.clear();
   }
   else {
@@ -417,7 +417,8 @@ if (curr.name == "return-unless" || curr.name == "reply-unless") {
 }
 
 :(code)
-void emit_return_block(recipe& out, const string& break_command, const vector<reagent>& ingredients) {
+void emit_return_block(recipe& out, const string& break_command, const instruction& inst) {
+  const vector<reagent>& ingredients = inst.ingredients;
   reagent/*copy*/ condition = ingredients.at(0);
   vector<reagent> return_ingredients;
   copy(++ingredients.begin(), ingredients.end(), inserter(return_ingredients, return_ingredients.end()));
@@ -438,6 +439,7 @@ void emit_return_block(recipe& out, const string& break_command, const vector<re
   return_inst.operation = get(Recipe_ordinal, "return");
   return_inst.name = "return";
   return_inst.ingredients.swap(return_ingredients);
+  return_inst.original_string = inst.original_string;
   out.steps.push_back(return_inst);
 
   // }