about summary refs log tree commit diff stats
path: root/057immutable.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-05-12 23:08:39 -0700
committerKartik Agaram <vc@akkartik.com>2018-05-12 23:08:39 -0700
commit059def11cb8c53d85f7eed2af98a0bca0120a9cc (patch)
treec24e543185fc9d054ad9c46a4f1d3a0021acf62f /057immutable.cc
parent1fb0cf9ef9e616163039fd4df6584c6c2ba68d23 (diff)
downloadmu-059def11cb8c53d85f7eed2af98a0bca0120a9cc.tar.gz
4244
Diffstat (limited to '057immutable.cc')
-rw-r--r--057immutable.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/057immutable.cc b/057immutable.cc
index 6cfcacef..d3c633b2 100644
--- a/057immutable.cc
+++ b/057immutable.cc
@@ -409,6 +409,32 @@ set<int> scan_contained_in_product_indices(const instruction& inst, set<int>& in
   return result;
 }
 
+bool is_mu_container(const reagent& r) {
+  return is_mu_container(r.type);
+}
+bool is_mu_container(const type_tree* type) {
+  if (!type) return false;
+  if (!type->atom)
+    return is_mu_container(get_base_type(type));
+  if (type->value == 0) return false;
+  if (!contains_key(Type, type->value)) return false;  // error raised elsewhere
+  type_info& info = get(Type, type->value);
+  return info.kind == CONTAINER;
+}
+
+bool is_mu_exclusive_container(const reagent& r) {
+  return is_mu_exclusive_container(r.type);
+}
+bool is_mu_exclusive_container(const type_tree* type) {
+  if (!type) return false;
+  if (!type->atom)
+    return is_mu_exclusive_container(get_base_type(type));
+  if (type->value == 0) return false;
+  if (!contains_key(Type, type->value)) return false;  // error raised elsewhere
+  type_info& info = get(Type, type->value);
+  return info.kind == EXCLUSIVE_CONTAINER;
+}
+
 :(scenarios transform)
 :(scenario immutability_infects_contained_in_variables)
 % Hide_errors = true;