about summary refs log tree commit diff stats
path: root/056recipe_header.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-30 10:37:13 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-30 10:40:52 -0700
commit3a49e7e992b23d212b0c1df9e93c6564d4823ef2 (patch)
tree4b93758e25d22847b10c64b17b00b6c27a1a1c13 /056recipe_header.cc
parent12b51f36dce4bf1148f02e1f3629c25fc45be2f9 (diff)
downloadmu-3a49e7e992b23d212b0c1df9e93c6564d4823ef2.tar.gz
2328
Forgot to run valgrind again. That triggered some trace cleanup as well.
Diffstat (limited to '056recipe_header.cc')
-rw-r--r--056recipe_header.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/056recipe_header.cc b/056recipe_header.cc
index cc47ca6a..8e8a84ab 100644
--- a/056recipe_header.cc
+++ b/056recipe_header.cc
@@ -128,15 +128,16 @@ void deduce_types_from_header(const recipe_ordinal r) {
   }
   for (long long int i = 0; i < SIZE(rr.steps); ++i) {
     instruction& inst = rr.steps.at(i);
-    trace(9993, "transform") << inst.to_string() << '\n';
+    trace(9992, "transform") << inst.to_string() << end();
     for (long long int i = 0; i < SIZE(inst.ingredients); ++i) {
       if (inst.ingredients.at(i).type) continue;
       inst.ingredients.at(i).type = new type_tree(*header[inst.ingredients.at(i).name]);
+      trace(9993, "transform") << "type of " << inst.ingredients.at(i).name << " is " << dump_types(inst.ingredients.at(i)) << end();
     }
     for (long long int i = 0; i < SIZE(inst.products); ++i) {
       if (inst.products.at(i).type) continue;
       inst.products.at(i).type = new type_tree(*header[inst.products.at(i).name]);
-      trace(9993, "transform") << "type of " << inst.products.at(i).name << " is " << dump_types(inst.products.at(i)) << '\n';
+      trace(9993, "transform") << "type of " << inst.products.at(i).name << " is " << dump_types(inst.products.at(i)) << end();
     }
   }
 }
@@ -172,6 +173,7 @@ recipe add2 x:number, y:number -> z:number [
   load-ingredients
   z <- add x, y
 ]
++transform: reply z:number
 +mem: storing 8 in location 1
 
 :(after "int main")
@@ -182,7 +184,7 @@ void deduce_fallthrough_reply(const recipe_ordinal r) {
   recipe& rr = Recipe[r];
   if (rr.products.empty()) return;
   if (rr.steps.empty()) return;
-  if (rr.steps.at(SIZE(rr.steps)-1).operation != REPLY) {
+  if (rr.steps.at(SIZE(rr.steps)-1).name != "reply") {
     instruction inst;
     inst.operation = REPLY;
     inst.name = "reply";
@@ -192,3 +194,17 @@ void deduce_fallthrough_reply(const recipe_ordinal r) {
     rr.steps.push_back(inst);
   }
 }
+
+:(scenario reply_on_fallthrough_already_exists)
+recipe main [
+  1:number/raw <- add2 3, 5
+]
+recipe add2 x:number, y:number -> z:number [
+  local-scope
+  load-ingredients
+  z <- add x, y  # no type for z
+  reply z
+]
++transform: reply z
+-transform: reply z:number
++mem: storing 8 in location 1