diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-10 16:47:17 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-10 16:47:17 -0700 |
commit | 271f101f85a9b482f6cdaac677bd391159d85cee (patch) | |
tree | d6334dd440747fb04b80c24692a92ac53077acf9 /033exclusive_container.cc | |
parent | e7f239014819c2b401c825650091bd5b55d0a679 (diff) | |
download | mu-271f101f85a9b482f6cdaac677bd391159d85cee.tar.gz |
3321
Clean up another case (after commit 3309) of premature support for shape-shifting recipes, where early layers had code without corresponding tests. One addendum to commit 3309: the proximal cause for triggering the rewrite of type_trees was that I realized to_string() and variants were lying to me while debugging; they couldn't distinguish between `(a . b)` and `((a) . b)`
Diffstat (limited to '033exclusive_container.cc')
-rw-r--r-- | 033exclusive_container.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/033exclusive_container.cc b/033exclusive_container.cc index fd870789..26711e51 100644 --- a/033exclusive_container.cc +++ b/033exclusive_container.cc @@ -109,8 +109,9 @@ case MAYBE_CONVERT: { raise << maybe(caller.name) << "first ingredient of 'maybe-convert' should be an exclusive-container, but got '" << base.original_string << "'\n" << end(); break; } - const type_tree* root_type = base.type->atom ? base.type : base.type->left; - if (!root_type->atom || root_type->value == 0 || !contains_key(Type, root_type->value) || get(Type, root_type->value).kind != EXCLUSIVE_CONTAINER) { + const type_tree* base_type = base.type; + // Update MAYBE_CONVERT base_type in Check + if (!base_type->atom || base_type->value == 0 || !contains_key(Type, base_type->value) || get(Type, base_type->value).kind != EXCLUSIVE_CONTAINER) { raise << maybe(caller.name) << "first ingredient of 'maybe-convert' should be an exclusive-container, but got '" << base.original_string << "'\n" << end(); break; } @@ -127,7 +128,7 @@ case MAYBE_CONVERT: { // Update MAYBE_CONVERT product in Check reagent& offset = inst.ingredients.at(1); populate_value(offset); - if (offset.value >= SIZE(get(Type, root_type->value).elements)) { + if (offset.value >= SIZE(get(Type, base_type->value).elements)) { raise << maybe(caller.name) << "invalid tag " << offset.value << " in '" << inst.original_string << '\n' << end(); break; } |