about summary refs log tree commit diff stats
path: root/061recipe.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-02-20 20:05:52 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-02-20 20:17:07 -0800
commit65c905fe84c0e8b7acd6839469d7bb9727f0632b (patch)
treeb9af97e9191b82675713cda3874677ee81b3bc9b /061recipe.cc
parent343bc5359b93d4b589544671804f11d42f67d694 (diff)
downloadmu-65c905fe84c0e8b7acd6839469d7bb9727f0632b.tar.gz
2678
Start using type names from the type tree rather than the property tree
in most places. Hopefully the only occurrences of
'properties.at(0).second' left are ones where we're managing it. Next we
can stop writing to it.
Diffstat (limited to '061recipe.cc')
-rw-r--r--061recipe.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/061recipe.cc b/061recipe.cc
index 3945ff49..890015e5 100644
--- a/061recipe.cc
+++ b/061recipe.cc
@@ -32,7 +32,7 @@ type_ordinal recipe = put(Type_ordinal, "recipe", Next_type_ordinal++);
 get_or_insert(Type, recipe).name = "recipe";
 
 :(before "End Null-type is_disqualified Exceptions")
-if (!x.properties.at(0).second && contains_key(Recipe_ordinal, x.name)) {
+if (!x.type && contains_key(Recipe_ordinal, x.name)) {
   x.properties.at(0).second = new string_tree("recipe-literal");
   x.type = new type_tree("recipe-literal", get(Type_ordinal, "recipe-literal"));
   x.set_value(get(Recipe_ordinal, x.name));
@@ -126,27 +126,26 @@ void check_indirect_calls_against_header(const recipe_ordinal r) {
 }
 
 recipe from_reagent(const reagent& r) {
-  assert(r.properties.at(0).second->value == "recipe");
+  assert(r.type->name == "recipe");
   recipe result_header;  // will contain only ingredients and products, nothing else
   result_header.has_header = true;
-  const string_tree* curr = r.properties.at(0).second->right;
+  const type_tree* curr = r.type->right;
   for (; curr; curr=curr->right) {
-    if (curr->value == "->") {
+    if (curr->name == "->") {
       curr = curr->right;  // skip delimiter
       break;
     }
-    result_header.ingredients.push_back("recipe:"+curr->value);
-  }
-  for (; curr; curr=curr->right) {
-    result_header.products.push_back("recipe:"+curr->value);
+    result_header.ingredients.push_back("recipe:"+curr->name);
   }
+  for (; curr; curr=curr->right)
+    result_header.products.push_back("recipe:"+curr->name);
   return result_header;
 }
 
 bool is_mu_recipe(reagent r) {
   if (!r.type) return false;
-  if (r.properties.at(0).second->value == "recipe") return true;
-  if (r.properties.at(0).second->value == "recipe-literal") return true;
+  if (r.type->name == "recipe") return true;
+  if (r.type->name == "recipe-literal") return true;
   // End is_mu_recipe Cases
   return false;
 }