diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-11-19 09:02:08 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-11-19 09:22:46 -0800 |
commit | 8a0f55cdffc03ee10b0d7b6740db89e622b4c1c1 (patch) | |
tree | 3e39855d068a727b5fa5afd18786707206dcd7d2 /998check_type_pointers.cc | |
parent | dc26989108c306260345b20e4e4f73c4411e5a2e (diff) | |
download | mu-8a0f55cdffc03ee10b0d7b6740db89e622b4c1c1.tar.gz |
2463 - make edit/ robust to errors in client code
Diffstat (limited to '998check_type_pointers.cc')
-rw-r--r-- | 998check_type_pointers.cc | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/998check_type_pointers.cc b/998check_type_pointers.cc index 36c548a9..da19cf3e 100644 --- a/998check_type_pointers.cc +++ b/998check_type_pointers.cc @@ -1,33 +1,36 @@ -:(before "End Transform All") -check_type_pointers(); - -:(code) -void check_type_pointers() { - for (map<recipe_ordinal, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { - if (any_type_ingredient_in_header(p->first)) continue; - const recipe& r = p->second; - for (long long int i = 0; i < SIZE(r.steps); ++i) { - const instruction& inst = r.steps.at(i); - for (long long int j = 0; j < SIZE(inst.ingredients); ++j) { - if (!inst.ingredients.at(j).type) { - raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.ingredients.at(j).to_string() << " has no type\n" << end(); - return; - } - if (!inst.ingredients.at(j).properties.at(0).second) { - raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.ingredients.at(j).to_string() << " has no type name\n" << end(); - return; - } - } - for (long long int j = 0; j < SIZE(inst.products); ++j) { - if (!inst.products.at(j).type) { - raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.products.at(j).to_string() << " has no type\n" << end(); - return; - } - if (!inst.products.at(j).properties.at(0).second) { - raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.products.at(j).to_string() << " has no type name\n" << end(); - return; - } - } - } - } -} +//: enable this when tracking down null types +//: (but it interferes with edit/; since recipes created in the environment +//: can raise warnings here which will stop running the entire environment) +//? :(before "End Transform All") +//? check_type_pointers(); +//? +//? :(code) +//? void check_type_pointers() { +//? for (map<recipe_ordinal, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { +//? if (any_type_ingredient_in_header(p->first)) continue; +//? const recipe& r = p->second; +//? for (long long int i = 0; i < SIZE(r.steps); ++i) { +//? const instruction& inst = r.steps.at(i); +//? for (long long int j = 0; j < SIZE(inst.ingredients); ++j) { +//? if (!inst.ingredients.at(j).type) { +//? raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.ingredients.at(j).to_string() << " has no type\n" << end(); +//? return; +//? } +//? if (!inst.ingredients.at(j).properties.at(0).second) { +//? raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.ingredients.at(j).to_string() << " has no type name\n" << end(); +//? return; +//? } +//? } +//? for (long long int j = 0; j < SIZE(inst.products); ++j) { +//? if (!inst.products.at(j).type) { +//? raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.products.at(j).to_string() << " has no type\n" << end(); +//? return; +//? } +//? if (!inst.products.at(j).properties.at(0).second) { +//? raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.products.at(j).to_string() << " has no type name\n" << end(); +//? return; +//? } +//? } +//? } +//? } +//? } |