diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-07-21 19:22:03 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-07-21 19:22:03 -0700 |
commit | 8d72e5652147a0218f36757fd9171f3f2beda887 (patch) | |
tree | b95edd6bb86f7d421327d2f436e0c2d375cb795d /025compare.cc | |
parent | fc19980d91e306df87b308d0c2875a2dcaf4b5c7 (diff) | |
download | mu-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 '025compare.cc')
-rw-r--r-- | 025compare.cc | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/025compare.cc b/025compare.cc index 6d12bf3c..058a016f 100644 --- a/025compare.cc +++ b/025compare.cc @@ -7,18 +7,18 @@ put(Recipe_ordinal, "equal", EQUAL); :(before "End Primitive Recipe Checks") case EQUAL: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'equal' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } const reagent& exemplar = inst.ingredients.at(0); for (int i = /*skip exemplar*/1; i < SIZE(inst.ingredients); ++i) { if (!types_match(inst.ingredients.at(i), exemplar) && !types_match(exemplar, inst.ingredients.at(i))) { - raise << maybe(get(Recipe, r).name) << "'equal' expects ingredients to be all of the same type, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' expects ingredients to be all of the same type, but got '" << inst.original_string << "'\n" << end(); goto finish_checking_instruction; } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'equal' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -81,16 +81,16 @@ put(Recipe_ordinal, "not-equal", NOT_EQUAL); :(before "End Primitive Recipe Checks") case NOT_EQUAL: { if (SIZE(inst.ingredients) != 2) { - raise << maybe(get(Recipe, r).name) << "'equal' needs two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' needs two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } const reagent& exemplar = inst.ingredients.at(0); if (!types_match(inst.ingredients.at(1), exemplar) && !types_match(exemplar, inst.ingredients.at(1))) { - raise << maybe(get(Recipe, r).name) << "'equal' expects ingredients to be all of the same type, but got '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' expects ingredients to be all of the same type, but got '" << inst.original_string << "'\n" << end(); goto finish_checking_instruction; } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'equal' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'equal' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -135,7 +135,7 @@ put(Recipe_ordinal, "greater-than", GREATER_THAN); :(before "End Primitive Recipe Checks") case GREATER_THAN: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'greater-than' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'greater-than' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -145,7 +145,7 @@ case GREATER_THAN: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'greater-than' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'greater-than' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -202,7 +202,7 @@ put(Recipe_ordinal, "lesser-than", LESSER_THAN); :(before "End Primitive Recipe Checks") case LESSER_THAN: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'lesser-than' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'lesser-than' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -212,7 +212,7 @@ case LESSER_THAN: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'lesser-than' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'lesser-than' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -269,7 +269,7 @@ put(Recipe_ordinal, "greater-or-equal", GREATER_OR_EQUAL); :(before "End Primitive Recipe Checks") case GREATER_OR_EQUAL: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'greater-or-equal' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'greater-or-equal' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -279,7 +279,7 @@ case GREATER_OR_EQUAL: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'greater-or-equal' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'greater-or-equal' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -344,7 +344,7 @@ put(Recipe_ordinal, "lesser-or-equal", LESSER_OR_EQUAL); :(before "End Primitive Recipe Checks") case LESSER_OR_EQUAL: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'lesser-or-equal' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'lesser-or-equal' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -354,7 +354,7 @@ case LESSER_OR_EQUAL: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'greater-or-equal' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'greater-or-equal' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_boolean(inst.products.at(0))) { @@ -419,7 +419,7 @@ put(Recipe_ordinal, "max", MAX); :(before "End Primitive Recipe Checks") case MAX: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'max' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'max' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -429,7 +429,7 @@ case MAX: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'max' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'max' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { @@ -458,7 +458,7 @@ put(Recipe_ordinal, "min", MIN); :(before "End Primitive Recipe Checks") case MIN: { if (SIZE(inst.ingredients) <= 1) { - raise << maybe(get(Recipe, r).name) << "'min' needs at least two ingredients to compare in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'min' needs at least two ingredients to compare in '" << inst.original_string << "'\n" << end(); break; } for (int i = 0; i < SIZE(inst.ingredients); ++i) { @@ -468,7 +468,7 @@ case MIN: { } } if (SIZE(inst.products) > 1) { - raise << maybe(get(Recipe, r).name) << "'min' yields exactly one product in '" << to_original_string(inst) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'min' yields exactly one product in '" << inst.original_string << "'\n" << end(); break; } if (!inst.products.empty() && !is_dummy(inst.products.at(0)) && !is_mu_number(inst.products.at(0))) { |