diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-01-30 22:22:52 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-01-30 22:22:52 -0800 |
commit | 4d238fd71e675d9fa060c03841cac9c356389b97 (patch) | |
tree | 4591b62fb6f518e1921a8c54fdf010c8b398af09 /059shape_shifting_recipe.cc | |
parent | 3bfd75fcf0eacdab7e26700fee92327cfbf420a5 (diff) | |
download | mu-4d238fd71e675d9fa060c03841cac9c356389b97.tar.gz |
2620
I was finding it hard to wrap around the directionality of calls with 'lhs' and 'rhs'. Seems to work better with 'to' and 'from'. Let's see.
Diffstat (limited to '059shape_shifting_recipe.cc')
-rw-r--r-- | 059shape_shifting_recipe.cc | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/059shape_shifting_recipe.cc b/059shape_shifting_recipe.cc index 97bd8dfe..5b423e9a 100644 --- a/059shape_shifting_recipe.cc +++ b/059shape_shifting_recipe.cc @@ -37,8 +37,8 @@ if (Current_routine->calls.front().running_step_index == 0 //: Make sure we don't match up literals with type ingredients without //: specialization. -:(before "End Matching Types For Literal(lhs)") -if (contains_type_ingredient_name(lhs)) return false; +:(before "End Matching Types For Literal(to)") +if (contains_type_ingredient_name(to)) return false; //: We'll be creating recipes without loading them from anywhere by //: *specializing* existing recipes. @@ -192,10 +192,10 @@ bool any_type_ingredient_in_header(recipe_ordinal variant) { return false; } -bool deeply_equal_concrete_types(reagent lhs, reagent rhs) { - canonize_type(lhs); - canonize_type(rhs); - return deeply_equal_concrete_types(lhs.properties.at(0).second, rhs.properties.at(0).second, rhs); +bool deeply_equal_concrete_types(reagent to, reagent from) { + canonize_type(to); + canonize_type(from); + return deeply_equal_concrete_types(to.properties.at(0).second, from.properties.at(0).second, from); } long long int number_of_concrete_types(recipe_ordinal r) { @@ -222,24 +222,24 @@ long long int number_of_concrete_types(const string_tree* type) { return result; } -bool deeply_equal_concrete_types(const string_tree* lhs, const string_tree* rhs, const reagent& rhs_reagent) { - if (!lhs) return !rhs; - if (!rhs) return !lhs; - if (is_type_ingredient_name(lhs->value)) return true; // type ingredient matches anything - if (lhs->value == "literal" && rhs->value == "literal") +bool deeply_equal_concrete_types(const string_tree* to, const string_tree* from, const reagent& rhs_reagent) { + if (!to) return !from; + if (!from) return !to; + if (is_type_ingredient_name(to->value)) return true; // type ingredient matches anything + if (to->value == "literal" && from->value == "literal") return true; - if (lhs->value == "literal" - && Literal_type_names.find(rhs->value) != Literal_type_names.end()) + if (to->value == "literal" + && Literal_type_names.find(from->value) != Literal_type_names.end()) return true; - if (rhs->value == "literal" - && Literal_type_names.find(lhs->value) != Literal_type_names.end()) + if (from->value == "literal" + && Literal_type_names.find(to->value) != Literal_type_names.end()) return true; - if (rhs->value == "literal" && lhs->value == "address") + if (from->value == "literal" && to->value == "address") return rhs_reagent.name == "0"; -//? cerr << lhs->value << " vs " << rhs->value << '\n'; - return lhs->value == rhs->value - && deeply_equal_concrete_types(lhs->left, rhs->left, rhs_reagent) - && deeply_equal_concrete_types(lhs->right, rhs->right, rhs_reagent); +//? cerr << to->value << " vs " << from->value << '\n'; + return to->value == from->value + && deeply_equal_concrete_types(to->left, from->left, rhs_reagent) + && deeply_equal_concrete_types(to->right, from->right, rhs_reagent); } bool contains_type_ingredient_name(const reagent& x) { |