about summary refs log tree commit diff stats
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/013run8
1 files changed, 6 insertions, 2 deletions
diff --git a/cpp/013run b/cpp/013run
index b26ce56f..22239667 100644
--- a/cpp/013run
+++ b/cpp/013run
@@ -130,7 +130,7 @@ vector<int> read_memory(reagent x) {
 
 //: beware: overridden in later layers
 void write_memory(reagent x, vector<int> data) {
-  if (x.name == "_") return;  // dummy results are never stored
+  if (is_dummy(x)) return;
   int base = x.value;
   size_t size = size_of(x);
   if (size != data.size()) raise << "size mismatch in storing to " << x.to_string();
@@ -141,13 +141,17 @@ void write_memory(reagent x, vector<int> data) {
 }
 
 :(code)
-size_t size_of(reagent r) {
+size_t size_of(const reagent& r) {
   type_info t = Type[r.types[0]];
   if (!t.is_record && !t.is_array) return t.size;
   // End size_of Cases.
   return t.size;
 }
 
+bool is_dummy(const reagent& x) {
+  return x.name == "_";
+}
+
 :(scenario run_label)
 recipe main [
   +foo