diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-08-02 22:18:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-08-02 22:18:19 -0700 |
commit | cfb142b9601cc648f15bf5738a3df09a23835e41 (patch) | |
tree | 670f168fbbf2693b17d679939bd1c203de1c3837 /021arithmetic.cc | |
parent | 37900254f083364dcfbb80cf7119c230a0b603d6 (diff) | |
download | mu-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 '021arithmetic.cc')
-rw-r--r-- | 021arithmetic.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/021arithmetic.cc b/021arithmetic.cc index 2a21c2cf..9c1de78b 100644 --- a/021arithmetic.cc +++ b/021arithmetic.cc @@ -43,7 +43,6 @@ SUBTRACT, Recipe_ordinal["subtract"] = SUBTRACT; :(before "End Primitive Recipe Implementations") case SUBTRACT: { - products.resize(1); if (ingredients.empty()) { raise << current_recipe_name() << ": 'subtract' has no ingredients\n" << end(); break; @@ -54,6 +53,7 @@ case SUBTRACT: { assert(scalar(ingredients.at(i))); result -= ingredients.at(i).at(0); } + products.resize(1); products.at(0).push_back(result); break; } @@ -120,7 +120,6 @@ DIVIDE, Recipe_ordinal["divide"] = DIVIDE; :(before "End Primitive Recipe Implementations") case DIVIDE: { - products.resize(1); if (ingredients.empty()) { raise << current_recipe_name() << ": 'divide' has no ingredients\n" << end(); break; @@ -131,6 +130,7 @@ case DIVIDE: { assert(scalar(ingredients.at(i))); result /= ingredients.at(i).at(0); } + products.resize(1); products.at(0).push_back(result); break; } |