about summary refs log tree commit diff stats
path: root/024compare.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-02 22:18:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-02 22:18:19 -0700
commitcfb142b9601cc648f15bf5738a3df09a23835e41 (patch)
tree670f168fbbf2693b17d679939bd1c203de1c3837 /024compare.cc
parent37900254f083364dcfbb80cf7119c230a0b603d6 (diff)
downloadmu-cfb142b9601cc648f15bf5738a3df09a23835e41.tar.gz
1923
Still iterating on the right way to handle incorrect number of
ingredients. My first idea of creating null results doesn't really work
once they're used in later instructions. Just add a warning at one place
in the run loop, but otherwise only add products when there's something
to save in them.

Undoes some work around commit 1886.
Diffstat (limited to '024compare.cc')
-rw-r--r--024compare.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/024compare.cc b/024compare.cc
index 7fb8c2e8..fb3481fd 100644
--- a/024compare.cc
+++ b/024compare.cc
@@ -6,7 +6,6 @@ EQUAL,
 Recipe_ordinal["equal"] = EQUAL;
 :(before "End Primitive Recipe Implementations")
 case EQUAL: {
-  products.resize(1);
   if (SIZE(ingredients) <= 1) {
     raise << current_recipe_name() << ": 'equal' needs at least two ingredients to compare in '" << current_instruction().to_string() << "'\n" << end();
     break;
@@ -19,6 +18,7 @@ case EQUAL: {
       break;
     }
   }
+  products.resize(1);
   products.at(0).push_back(result);
   break;
 }
@@ -61,7 +61,6 @@ GREATER_THAN,
 Recipe_ordinal["greater-than"] = GREATER_THAN;
 :(before "End Primitive Recipe Implementations")
 case GREATER_THAN: {
-  products.resize(1);
   bool result = true;
   if (SIZE(ingredients) <= 1) {
     raise << current_recipe_name() << ": 'greater-than' needs at least two ingredients to compare in '" << current_instruction().to_string() << "'\n" << end();
@@ -79,6 +78,7 @@ case GREATER_THAN: {
     }
   }
   finish_greater_than:
+  products.resize(1);
   products.at(0).push_back(result);
   break;
 }
@@ -117,7 +117,6 @@ LESSER_THAN,
 Recipe_ordinal["lesser-than"] = LESSER_THAN;
 :(before "End Primitive Recipe Implementations")
 case LESSER_THAN: {
-  products.resize(1);
   bool result = true;
   if (SIZE(ingredients) <= 1) {
     raise << current_recipe_name() << ": 'lesser-than' needs at least two ingredients to compare in '" << current_instruction().to_string() << "'\n" << end();
@@ -135,6 +134,7 @@ case LESSER_THAN: {
     }
   }
   finish_lesser_than:
+  products.resize(1);
   products.at(0).push_back(result);
   break;
 }
@@ -173,7 +173,6 @@ GREATER_OR_EQUAL,
 Recipe_ordinal["greater-or-equal"] = GREATER_OR_EQUAL;
 :(before "End Primitive Recipe Implementations")
 case GREATER_OR_EQUAL: {
-  products.resize(1);
   bool result = true;
   if (SIZE(ingredients) <= 1) {
     raise << current_recipe_name() << ": 'greater-or-equal' needs at least two ingredients to compare in '" << current_instruction().to_string() << "'\n" << end();
@@ -191,6 +190,7 @@ case GREATER_OR_EQUAL: {
     }
   }
   finish_greater_or_equal:
+  products.resize(1);
   products.at(0).push_back(result);
   break;
 }
@@ -237,7 +237,6 @@ LESSER_OR_EQUAL,
 Recipe_ordinal["lesser-or-equal"] = LESSER_OR_EQUAL;
 :(before "End Primitive Recipe Implementations")
 case LESSER_OR_EQUAL: {
-  products.resize(1);
   bool result = true;
   if (SIZE(ingredients) <= 1) {
     raise << current_recipe_name() << ": 'lesser-or-equal' needs at least two ingredients to compare in '" << current_instruction().to_string() << "'\n" << end();
@@ -255,6 +254,7 @@ case LESSER_OR_EQUAL: {
     }
   }
   finish_lesser_or_equal:
+  products.resize(1);
   products.at(0).push_back(result);
   break;
 }