about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--010vm.cc28
-rw-r--r--057static_dispatch.cc21
2 files changed, 17 insertions, 32 deletions
diff --git a/010vm.cc b/010vm.cc
index 52e66f15..ab003c73 100644
--- a/010vm.cc
+++ b/010vm.cc
@@ -476,34 +476,6 @@ string_tree* property(const reagent& r, const string& name) {
   return NULL;
 }
 
-bool deeply_equal(const string_tree* a, const string_tree* b) {
-  if (!a) return !b;
-  if (!b) return !a;
-  return a->value == b->value
-      && deeply_equal(a->left, b->left)
-      && deeply_equal(a->right, b->right);
-}
-
-:(before "End Globals")
-set<string> Literal_type_names;
-:(before "End One-time Setup")
-Literal_type_names.insert("number");
-Literal_type_names.insert("character");
-:(code)
-bool deeply_equal_types(const string_tree* a, const string_tree* b) {
-  if (!a) return !b;
-  if (!b) return !a;
-  if (a->value == "literal" && b->value == "literal")
-    return true;
-  if (a->value == "literal")
-    return Literal_type_names.find(b->value) != Literal_type_names.end();
-  if (b->value == "literal")
-    return Literal_type_names.find(a->value) != Literal_type_names.end();
-  return a->value == b->value
-      && deeply_equal_types(a->left, b->left)
-      && deeply_equal_types(a->right, b->right);
-}
-
 void dump_memory() {
   for (map<long long int, double>::iterator p = Memory.begin(); p != Memory.end(); ++p) {
     cout << p->first << ": " << no_scientific(p->second) << '\n';
diff --git a/057static_dispatch.cc b/057static_dispatch.cc
index 114d7c7c..223e6ec9 100644
--- a/057static_dispatch.cc
+++ b/057static_dispatch.cc
@@ -76,11 +76,24 @@ bool all_reagents_match(const recipe& r1, const recipe& r2) {
   return true;
 }
 
-bool exact_match(type_tree* a, type_tree* b) {
-  if (a == b) return true;
+:(before "End Globals")
+set<string> Literal_type_names;
+:(before "End One-time Setup")
+Literal_type_names.insert("number");
+Literal_type_names.insert("character");
+:(code)
+bool deeply_equal_types(const string_tree* a, const string_tree* b) {
+  if (!a) return !b;
+  if (!b) return !a;
+  if (a->value == "literal" && b->value == "literal")
+    return true;
+  if (a->value == "literal")
+    return Literal_type_names.find(b->value) != Literal_type_names.end();
+  if (b->value == "literal")
+    return Literal_type_names.find(a->value) != Literal_type_names.end();
   return a->value == b->value
-      && exact_match(a->left, b->left)
-      && exact_match(a->right, b->right);
+      && deeply_equal_types(a->left, b->left)
+      && deeply_equal_types(a->right, b->right);
 }
 
 string next_unused_recipe_name(const string& recipe_name) {