about summary refs log tree commit diff stats
path: root/057shape_shifting_container.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-15 18:06:28 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-15 18:13:25 -0700
commit8e1c4783692824238b2d55f8e00bd996261d521c (patch)
tree40306ed08322ebd81b21a09ee7bcdef93679fe54 /057shape_shifting_container.cc
parent52522c1affe8d9dd3af96b8ed806ff5c55c5d0e9 (diff)
downloadmu-8e1c4783692824238b2d55f8e00bd996261d521c.tar.gz
2965 - update refcounts when copying containers
This is hopefully quite thorough. I handle nested containers, as well as
exclusive containers that might contain addresses only when the tag has
a specific value.
Diffstat (limited to '057shape_shifting_container.cc')
-rw-r--r--057shape_shifting_container.cc17
1 files changed, 5 insertions, 12 deletions
diff --git a/057shape_shifting_container.cc b/057shape_shifting_container.cc
index d1feb0fb..fb847899 100644
--- a/057shape_shifting_container.cc
+++ b/057shape_shifting_container.cc
@@ -252,15 +252,8 @@ replace_type_ingredients(element, type, info);
 :(before "Compute Exclusive Container Size(element)")
 replace_type_ingredients(element, type, info);
 :(before "Compute Container Address Offset(element)")
-replace_type_ingredients(element, curr_type, curr_info);
-if (contains_type_ingredient(element)) {
-  // error raised elsewhere; just clean up and leave
-  while (!containers.empty()) {
-    delete containers.top().first;
-    containers.pop();
-  }
-  return;
-}
+replace_type_ingredients(element, type, info);
+if (contains_type_ingredient(element)) return true;  // error raised elsewhere
 
 :(code)
 void replace_type_ingredients(reagent& element, const type_tree* caller_type, const type_info& info) {
@@ -613,7 +606,7 @@ def main [
 
 :(before "End variant_type Special-cases")
 if (contains_type_ingredient(element)) {
-  if (!base.type->right)
-    raise << "illegal type '" << to_string(base.type) << "' seems to be missing a type ingredient or three\n" << end();
-  replace_type_ingredients(element.type, base.type->right, info);
+  if (!type->right)
+    raise << "illegal type '" << to_string(type) << "' seems to be missing a type ingredient or three\n" << end();
+  replace_type_ingredients(element.type, type->right, info);
 }