diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-05-15 18:06:28 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-05-15 18:13:25 -0700 |
commit | 8e1c4783692824238b2d55f8e00bd996261d521c (patch) | |
tree | 40306ed08322ebd81b21a09ee7bcdef93679fe54 /033exclusive_container.cc | |
parent | 52522c1affe8d9dd3af96b8ed806ff5c55c5d0e9 (diff) | |
download | mu-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 '033exclusive_container.cc')
-rw-r--r-- | 033exclusive_container.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/033exclusive_container.cc b/033exclusive_container.cc index 3811fd03..dc84f2b7 100644 --- a/033exclusive_container.cc +++ b/033exclusive_container.cc @@ -169,10 +169,14 @@ case MAYBE_CONVERT: { :(code) const reagent variant_type(const reagent& base, int tag) { + return variant_type(base.type, tag); +} + +const reagent variant_type(const type_tree* type, int tag) { assert(tag >= 0); - assert(contains_key(Type, base.type->value)); - assert(!get(Type, base.type->value).name.empty()); - const type_info& info = get(Type, base.type->value); + assert(contains_key(Type, type->value)); + assert(!get(Type, type->value).name.empty()); + const type_info& info = get(Type, type->value); assert(info.kind == EXCLUSIVE_CONTAINER); reagent/*copy*/ element = info.elements.at(tag); // End variant_type Special-cases |