https://github.com/akkartik/mu/blob/master/998check_type_pointers.cc

     1 //: enable this when tracking down null types
     2 //: (but it interferes with edit/; since recipes created in the environment
     3 //: can raise warnings here which will stop running the entire environment)
     4 //? :(before "End Transform All")
     5 //? check_type_pointers();
     6 //?
     7 //? :(code)
     8 //? void check_type_pointers() {
     9 //?   for (map<recipe_ordinal, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) {
    10 //?     if (any_type_ingredient_in_header(p->first)) continue;
    11 //?     const recipe& r = p->second;
    12 //?     for (long long int i = 0; i < SIZE(r.steps); ++i) {
    13 //?       const instruction& inst = r.steps.at(i);
    14 //?       for (long long int j = 0; j < SIZE(inst.ingredients); ++j) {
    15 //?         if (!inst.ingredients.at(j).type) {
    16 //?           raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.ingredients.at(j).to_string() << " has no type\n" << end();
    17 //?           return;
    18 //?         }
    19 //?         if (!inst.ingredients.at(j).properties.at(0).second) {
    20 //?           raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.ingredients.at(j).to_string() << " has no type name\n" << end();
    21 //?           return;
    22 //?         }
    23 //?       }
    24 //?       for (long long int j = 0; j < SIZE(inst.products); ++j) {
    25 //?         if (!inst.products.at(j).type) {
    26 //?           raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.products.at(j).to_string() << " has no type\n" << end();
    27 //?           return;
    28 //?         }
    29 //?         if (!inst.products.at(j).properties.at(0).second) {
    30 //?           raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.products.at(j).to_string() << " has no type name\n" << end();
    31 //?           return;
    32 //?         }
    33 //?       }
    34 //?     }
    35 //?   }
    36 //? }