diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-03-26 17:40:31 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-03-26 20:24:34 -0700 |
commit | 62ed0e4728ab0238c47f03dea38782a599bff3fb (patch) | |
tree | 0a91846931218ecd9f0fd23cb14366d91a2ad182 /cpp/018record | |
parent | 89173e25a96f9e940986185aaac4506be6a392c6 (diff) | |
download | mu-62ed0e4728ab0238c47f03dea38782a599bff3fb.tar.gz |
978
Diffstat (limited to 'cpp/018record')
-rw-r--r-- | cpp/018record | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cpp/018record b/cpp/018record index 91e142a3..5c1715a4 100644 --- a/cpp/018record +++ b/cpp/018record @@ -144,3 +144,23 @@ recipe main [ +run: ingredient 1 is 1 +run: address to copy is 13 +mem: storing 13 in location 15 + +:(scenario "copy_handles_nested_record_elements") +recipe main [ + 12:integer <- copy 34:literal + 13:integer <- copy 35:literal + 14:integer <- copy 36:literal + 15:point-integer <- copy 12:point-integer +] ++mem: storing 36 in location 17 + +:(before "End size_of Cases") +if (t.is_record) { + size_t result = 0; + for (size_t i = 0; i < t.elements.size(); ++i) { + reagent x; + x.types.push_back(t.elements[i][0]); + result += size_of(x); + } + return result; +} |