about summary refs log tree commit diff stats
path: root/031merge.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 /031merge.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 '031merge.cc')
-rw-r--r--031merge.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/031merge.cc b/031merge.cc
index abc1bbc5..21c036c8 100644
--- a/031merge.cc
+++ b/031merge.cc
@@ -119,19 +119,19 @@ void check_merge_calls(const recipe_ordinal r) {
     const instruction& inst = caller.steps.at(i);
     if (inst.name != "merge") continue;
     if (SIZE(inst.products) != 1) {
-      raise << maybe(caller.name) << "'merge' should yield a single product in '" << to_original_string(inst) << "'\n" << end();
+      raise << maybe(caller.name) << "'merge' should yield a single product in '" << inst.original_string << "'\n" << end();
       continue;
     }
     reagent/*copy*/ product = inst.products.at(0);
     // Update product While Type-checking Merge
     type_ordinal product_type = product.type->value;
     if (product_type == 0 || !contains_key(Type, product_type)) {
-      raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end();
+      raise << maybe(caller.name) << "'merge' should yield a container in '" << inst.original_string << "'\n" << end();
       continue;
     }
     const type_info& info = get(Type, product_type);
     if (info.kind != CONTAINER && info.kind != EXCLUSIVE_CONTAINER) {
-      raise << maybe(caller.name) << "'merge' should yield a container in '" << to_original_string(inst) << "'\n" << end();
+      raise << maybe(caller.name) << "'merge' should yield a container in '" << inst.original_string << "'\n" << end();
       continue;
     }
     check_merge_call(inst.ingredients, product, caller, inst);
@@ -146,7 +146,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product
     assert(!state.data.empty());
     trace(9999, "transform") << ingredient_index << " vs " << SIZE(ingredients) << end();
     if (ingredient_index >= SIZE(ingredients)) {
-      raise << maybe(caller.name) << "too few ingredients in '" << to_original_string(inst) << "'\n" << end();
+      raise << maybe(caller.name) << "too few ingredients in '" << inst.original_string << "'\n" << end();
       return;
     }
     reagent& container = state.data.top().container;
@@ -167,7 +167,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product
             state.data.pop();
             if (state.data.empty()) {
               if (ingredient_index < SIZE(ingredients))
-                raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end();
+                raise << maybe(caller.name) << "too many ingredients in '" << inst.original_string << "'\n" << end();
               return;
             }
             ++state.data.top().container_element_index;
@@ -183,7 +183,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product
       // End check_merge_call Cases
       default: {
         if (!types_coercible(container, ingredients.at(ingredient_index))) {
-          raise << maybe(caller.name) << "incorrect type of ingredient " << ingredient_index << " in '" << to_original_string(inst) << "'\n" << end();
+          raise << maybe(caller.name) << "incorrect type of ingredient " << ingredient_index << " in '" << inst.original_string << "'\n" << end();
           raise << "  (expected '" << debug_string(container) << "')\n" << end();
           raise << "  (got '" << debug_string(ingredients.at(ingredient_index)) << "')\n" << end();
           return;
@@ -194,7 +194,7 @@ void check_merge_call(const vector<reagent>& ingredients, const reagent& product
           state.data.pop();
           if (state.data.empty()) {
             if (ingredient_index < SIZE(ingredients))
-              raise << maybe(caller.name) << "too many ingredients in '" << to_original_string(inst) << "'\n" << end();
+              raise << maybe(caller.name) << "too many ingredients in '" << inst.original_string << "'\n" << end();
             return;
           }
           ++state.data.top().container_element_index;