about summary refs log tree commit diff stats
path: root/058shape_shifting_recipe.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-03-19 00:51:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-03-19 00:53:45 -0700
commit968866f7ac183811e449b11da9b2a2f1b0d97227 (patch)
tree6bd8d4f1412d4d2ccc7a74f0537c166bf0fda77e /058shape_shifting_recipe.cc
parent1d1faace5d624b7bac96eb57a9373d2511ac08e1 (diff)
downloadmu-968866f7ac183811e449b11da9b2a2f1b0d97227.tar.gz
2791
Simplify 2790 by simply not computing any type->value inside
parse_type_tree. It now only generates names, and it turns out the
consumers handle the absence of values anyway. Now parse_type_tree no
longer pollutes the Type_ordinal table with type ingredients.
Diffstat (limited to '058shape_shifting_recipe.cc')
-rw-r--r--058shape_shifting_recipe.cc17
1 files changed, 3 insertions, 14 deletions
diff --git a/058shape_shifting_recipe.cc b/058shape_shifting_recipe.cc
index 26e0eaf6..784b1fd0 100644
--- a/058shape_shifting_recipe.cc
+++ b/058shape_shifting_recipe.cc
@@ -463,13 +463,8 @@ type_tree* parse_type_tree(istream& in) {
     in.get();
     return NULL;
   }
-  if (in.peek() != '(') {
-    string type_name = next_word(in);
-    if (!contains_key(Type_ordinal, type_name))
-      put(Type_ordinal, type_name, Next_type_ordinal++);
-    type_tree* result = new type_tree(type_name, get(Type_ordinal, type_name));
-    return result;
-  }
+  if (in.peek() != '(')
+    return new type_tree(next_word(in), 0);
   in.get();  // skip '('
   type_tree* result = NULL;
   type_tree** curr = &result;
@@ -479,14 +474,8 @@ type_tree* parse_type_tree(istream& in) {
     skip_whitespace_but_not_newline(in);
     if (in.peek() == '(')
       (*curr)->left = parse_type_tree(in);
-    else {
+    else
       (*curr)->name = next_word(in);
-      if (!is_type_ingredient_name((*curr)->name)) {
-        if (!contains_key(Type_ordinal, (*curr)->name))
-          put(Type_ordinal, (*curr)->name, Next_type_ordinal++);
-        (*curr)->value = get(Type_ordinal, (*curr)->name);
-      }
-    }
     curr = &(*curr)->right;
   }
   in.get();  // skip ')'