From 558bf3d388ee75cc3f37ba27b097af2f73e20b52 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 28 Jun 2016 23:10:42 -0700 Subject: 3073 Support for containers without addresses. --- 073deep_copy.cc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/073deep_copy.cc b/073deep_copy.cc index f564c81d..3f4edbb5 100644 --- a/073deep_copy.cc +++ b/073deep_copy.cc @@ -12,9 +12,23 @@ def main [ local-scope x:number <- copy 34 y:number <- deep-copy x - 10:boolean/raw <- equal x y + 10:boolean/raw <- equal x, y ] -# non-addresses are identical +# non-address primitives are identical ++mem: storing 1 in location 10 + +:(scenario deep_copy_container_without_address) +container foo [ + x:number + y:number +] +def main [ + local-scope + a:foo <- merge 34 35 + b:foo <- deep-copy a + 10:boolean/raw <- equal a, b +] +# containers are identical as long as they don't contain addresses +mem: storing 1 in location 10 :(before "End Primitive Recipe Declarations") @@ -71,4 +85,9 @@ void deep_copy(const reagent& canonized_in, map& addresses_copied, vec out.push_back(result.at(0)); return; } + if (get(Container_metadata, canonized_in.type).address.empty()) { + vector result = read_memory(canonized_in); + out.insert(out.end(), result.begin(), result.end()); + return; + } } -- cgit 1.4.1-2-gfad0