about summary refs log tree commit diff stats
path: root/057immutable.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-07-21 19:22:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-07-21 19:22:03 -0700
commit8d72e5652147a0218f36757fd9171f3f2beda887 (patch)
treeb95edd6bb86f7d421327d2f436e0c2d375cb795d /057immutable.cc
parentfc19980d91e306df87b308d0c2875a2dcaf4b5c7 (diff)
downloadmu-8d72e5652147a0218f36757fd9171f3f2beda887.tar.gz
3120
Always show instruction before any transforms in error messages.

This is likely going to make some errors unclear because they *need* to
show the original instruction. But if we don't have tests for those
situations did they ever really work?
Diffstat (limited to '057immutable.cc')
-rw-r--r--057immutable.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/057immutable.cc b/057immutable.cc
index 4513b5db..0d82c010 100644
--- a/057immutable.cc
+++ b/057immutable.cc
@@ -435,9 +435,9 @@ void check_immutable_ingredient_in_instruction(const instruction& inst, const se
         && current_ingredient_and_aliases.find(inst.products.at(i)) != current_ingredient_and_aliases.end()) {
       string current_product_name = inst.products.at(i).name;
       if (current_product_name == original_ingredient_name)
-        raise << maybe(caller.name) << "cannot modify '" << current_product_name << "' in instruction '" << to_original_string(inst) << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end();
+        raise << maybe(caller.name) << "cannot modify '" << current_product_name << "' in instruction '" << inst.original_string << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end();
       else
-        raise << maybe(caller.name) << "cannot modify '" << current_product_name << "' in instruction '" << to_original_string(inst) << "' because that would modify " << original_ingredient_name << " which is an ingredient of recipe " << caller.name << " but not also a product\n" << end();
+        raise << maybe(caller.name) << "cannot modify '" << current_product_name << "' in instruction '" << inst.original_string << "' because that would modify " << original_ingredient_name << " which is an ingredient of recipe " << caller.name << " but not also a product\n" << end();
       return;
     }
   }
@@ -458,9 +458,9 @@ void check_immutable_ingredient_in_instruction(const instruction& inst, const se
       if (inst.operation == PUT || inst.operation == PUT_INDEX) {
         if (current_ingredient_index == 0) {
           if (current_ingredient_name == original_ingredient_name)
-            raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << to_original_string(inst) << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end();
+            raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << inst.original_string << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end();
           else
-            raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << to_original_string(inst) << "' because that would modify '" << original_ingredient_name << "' which is an ingredient of recipe " << caller.name << " but not also a product\n" << end();
+            raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << inst.original_string << "' because that would modify '" << original_ingredient_name << "' which is an ingredient of recipe " << caller.name << " but not also a product\n" << end();
         }
       }
     }
@@ -468,9 +468,9 @@ void check_immutable_ingredient_in_instruction(const instruction& inst, const se
       // defined recipe
       if (is_modified_in_recipe(inst.operation, current_ingredient_index, caller)) {
         if (current_ingredient_name == original_ingredient_name)
-          raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << to_original_string(inst) << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end();
+          raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << inst.original_string << "' because it's an ingredient of recipe " << caller.name << " but not also a product\n" << end();
         else
-          raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << to_original_string(inst) << "' because that would modify '" << original_ingredient_name << "' which is an ingredient of recipe " << caller.name << " but not also a product\n" << end();
+          raise << maybe(caller.name) << "cannot modify '" << current_ingredient_name << "' in instruction '" << inst.original_string << "' because that would modify '" << original_ingredient_name << "' which is an ingredient of recipe " << caller.name << " but not also a product\n" << end();
       }
     }
   }