2463 - make edit/ robust to errors in client code

This commit is contained in:
Kartik K. Agaram 2015-11-19 09:02:08 -08:00
parent dc26989108
commit 8a0f55cdff
2 changed files with 38 additions and 33 deletions

View File

@ -158,6 +158,8 @@ case SCREEN_SHOULD_CONTAIN: {
} }
:(before "End Primitive Recipe Implementations") :(before "End Primitive Recipe Implementations")
case SCREEN_SHOULD_CONTAIN: { case SCREEN_SHOULD_CONTAIN: {
//? cerr << SIZE(get(Recipe_variants, "insert")) << '\n';
//? cerr << debug_string(get(Recipe, get(Recipe_ordinal, "insert_4"))) << '\n';
if (!Passed) break; if (!Passed) break;
check_screen(current_instruction().ingredients.at(0).name, -1); check_screen(current_instruction().ingredients.at(0).name, -1);
break; break;

View File

@ -1,33 +1,36 @@
:(before "End Transform All") //: enable this when tracking down null types
check_type_pointers(); //: (but it interferes with edit/; since recipes created in the environment
//: can raise warnings here which will stop running the entire environment)
:(code) //? :(before "End Transform All")
void check_type_pointers() { //? 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; //? :(code)
const recipe& r = p->second; //? void check_type_pointers() {
for (long long int i = 0; i < SIZE(r.steps); ++i) { //? for (map<recipe_ordinal, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) {
const instruction& inst = r.steps.at(i); //? if (any_type_ingredient_in_header(p->first)) continue;
for (long long int j = 0; j < SIZE(inst.ingredients); ++j) { //? const recipe& r = p->second;
if (!inst.ingredients.at(j).type) { //? for (long long int i = 0; i < SIZE(r.steps); ++i) {
raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.ingredients.at(j).to_string() << " has no type\n" << end(); //? const instruction& inst = r.steps.at(i);
return; //? for (long long int j = 0; j < SIZE(inst.ingredients); ++j) {
} //? if (!inst.ingredients.at(j).type) {
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\n" << end();
raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.ingredients.at(j).to_string() << " has no type name\n" << end(); //? return;
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();
for (long long int j = 0; j < SIZE(inst.products); ++j) { //? return;
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; //? for (long long int j = 0; j < SIZE(inst.products); ++j) {
} //? if (!inst.products.at(j).type) {
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\n" << end();
raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.products.at(j).to_string() << " has no type name\n" << end(); //? return;
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;
} //? }
} //? }
//? }
//? }
//? }