diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-01-17 23:15:03 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-01-17 23:15:03 -0800 |
commit | 83d8299d2d966c39b4970828ff5743a5b05e3287 (patch) | |
tree | d2b0203d068b1c5651c58928c0f2fdf98d558789 /042name.cc | |
parent | 94fed2020040cf469bd47c8890ed4e609e3ed561 (diff) | |
download | mu-83d8299d2d966c39b4970828ff5743a5b05e3287.tar.gz |
2562
We want to use the type 'recipe' for recipe *variables*, because it seems nicer to say `recipe number -> number` rather than recipe-ordinal, etc. To support this we'll allow recipe names to be mentioned without any type. This might make a couple of places in this commit more brittle. I'm dropping error messages, causing them to not happen in some situations. Maybe I should just bite the bullet and require an explicit :recipe-literal. We'll see.
Diffstat (limited to '042name.cc')
-rw-r--r-- | 042name.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/042name.cc b/042name.cc index 2622f41c..7ad45b89 100644 --- a/042name.cc +++ b/042name.cc @@ -44,18 +44,20 @@ void transform_names(const recipe_ordinal r) { // End transform_names(inst) Special-cases // map names to addresses for (long long int in = 0; in < SIZE(inst.ingredients); ++in) { + if (disqualified(inst.ingredients.at(in), inst, caller.name)) continue; if (is_numeric_location(inst.ingredients.at(in))) numeric_locations_used = true; if (is_named_location(inst.ingredients.at(in))) names_used = true; - if (disqualified(inst.ingredients.at(in), inst, caller.name)) continue; + if (is_integer(inst.ingredients.at(in).name)) continue; if (!already_transformed(inst.ingredients.at(in), names)) { raise_error << maybe(caller.name) << "use before set: " << inst.ingredients.at(in).name << '\n' << end(); } inst.ingredients.at(in).set_value(lookup_name(inst.ingredients.at(in), r)); } for (long long int out = 0; out < SIZE(inst.products); ++out) { + if (disqualified(inst.products.at(out), inst, caller.name)) continue; if (is_numeric_location(inst.products.at(out))) numeric_locations_used = true; if (is_named_location(inst.products.at(out))) names_used = true; - if (disqualified(inst.products.at(out), inst, caller.name)) continue; + if (is_integer(inst.products.at(out).name)) continue; if (names.find(inst.products.at(out).name) == names.end()) { trace(9993, "name") << "assign " << inst.products.at(out).name << " " << curr_idx << end(); names[inst.products.at(out).name] = curr_idx; @@ -70,12 +72,12 @@ void transform_names(const recipe_ordinal r) { bool disqualified(/*mutable*/ reagent& x, const instruction& inst, const string& recipe_name) { if (!x.type) { + // End transform_names Exceptions raise_error << maybe(recipe_name) << "missing type for " << x.original_string << " in '" << inst.to_string() << "'\n" << end(); return true; } if (is_raw(x)) return true; if (is_literal(x)) return true; - if (is_integer(x.name)) return true; // End Disqualified Reagents if (x.initialized) return true; return false; |