about summary refs log tree commit diff stats
path: root/cpp/013run
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-21 16:54:00 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-21 16:54:00 -0700
commit6b6dfb0cc36e9aed46927ea8525937b6454b1df5 (patch)
tree5e6536f7dfedffb410314d71e077019c787ebd87 /cpp/013run
parent72cc3ae158eb444893f0837e3fc3bc99ca6d83f0 (diff)
downloadmu-6b6dfb0cc36e9aed46927ea8525937b6454b1df5.tar.gz
964
Diffstat (limited to 'cpp/013run')
-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