about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-01 12:49:47 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-01 12:49:47 -0800
commit6d79cc137b045ace341f666a67054bdeddef992e (patch)
tree915580af0aa329689250cf3074c62c01bc731134
parent99be6e083948d9872c64cad95826712bcda91266 (diff)
downloadmu-6d79cc137b045ace341f666a67054bdeddef992e.tar.gz
2338
-rw-r--r--048check_type_by_name.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/048check_type_by_name.cc b/048check_type_by_name.cc
index e6bedbc9..fcefbaf6 100644
--- a/048check_type_by_name.cc
+++ b/048check_type_by_name.cc
@@ -19,29 +19,29 @@ recipe main [
 
 :(code)
 void check_types_by_name(const recipe_ordinal r) {
-  map<string, type_tree*> metadata;
+  map<string, type_tree*> type;
   for (long long int i = 0; i < SIZE(Recipe[r].steps); ++i) {
     instruction& inst = Recipe[r].steps.at(i);
     for (long long int in = 0; in < SIZE(inst.ingredients); ++in) {
-      deduce_missing_type(metadata, inst.ingredients.at(in));
-      check_metadata(metadata, inst.ingredients.at(in), r);
+      deduce_missing_type(type, inst.ingredients.at(in));
+      check_type(type, inst.ingredients.at(in), r);
     }
     for (long long int out = 0; out < SIZE(inst.products); ++out) {
-      deduce_missing_type(metadata, inst.products.at(out));
-      check_metadata(metadata, inst.products.at(out), r);
+      deduce_missing_type(type, inst.products.at(out));
+      check_type(type, inst.products.at(out), r);
     }
   }
 }
 
-void check_metadata(map<string, type_tree*>& metadata, const reagent& x, const recipe_ordinal r) {
+void check_type(map<string, type_tree*>& type, const reagent& x, const recipe_ordinal r) {
   if (is_literal(x)) return;
   if (is_raw(x)) return;
   // if you use raw locations you're probably doing something unsafe
   if (is_integer(x.name)) return;
   if (!x.type) return;  // will throw a more precise error elsewhere
-  if (metadata.find(x.name) == metadata.end())
-    metadata[x.name] = x.type;
-  if (!types_match(metadata[x.name], x.type))
+  if (type.find(x.name) == type.end())
+    type[x.name] = x.type;
+  if (!types_match(type[x.name], x.type))
     raise_error << maybe(Recipe[r].name) << x.name << " used with multiple types\n" << end();
 }
 
@@ -52,10 +52,10 @@ recipe main [
 ]
 
 :(code)
-void deduce_missing_type(map<string, type_tree*>& metadata, reagent& x) {
+void deduce_missing_type(map<string, type_tree*>& type, reagent& x) {
   if (x.type) return;
-  if (metadata.find(x.name) == metadata.end()) return;
-  x.type = new type_tree(*metadata[x.name]);
+  if (type.find(x.name) == type.end()) return;
+  x.type = new type_tree(*type[x.name]);
   assert(!x.properties.at(0).second);
   x.properties.at(0).second = new string_tree("as-before");
 }