about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-06-12 00:10:32 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-06-12 00:10:32 -0700
commit6dd675764158bca3ab9547f6c653bdf8ba277d43 (patch)
tree8dc956b0c3fa12b3377c80f1f6a3d91fca5532e7
parenta9b225f70616593085a2d5975962e7e958b86ce8 (diff)
downloadmu-6dd675764158bca3ab9547f6c653bdf8ba277d43.tar.gz
3051
-rw-r--r--020run.cc2
-rw-r--r--060recipe.cc25
2 files changed, 25 insertions, 2 deletions
diff --git a/020run.cc b/020run.cc
index 03efcd79..df42abc0 100644
--- a/020run.cc
+++ b/020run.cc
@@ -158,6 +158,8 @@ if (argc > 1) {
   if (Run_tests) Recipe.erase(get(Recipe_ordinal, "main"));
 }
 transform_all();
+//? DUMP("");
+//? exit(0);
 save_snapshots();
 
 //: Step 3: if we aren't running tests, locate a recipe called 'main' and
diff --git a/060recipe.cc b/060recipe.cc
index c1904eb8..d60badb6 100644
--- a/060recipe.cc
+++ b/060recipe.cc
@@ -136,13 +136,21 @@ recipe from_reagent(const reagent& r) {
       curr = curr->right;  // skip delimiter
       break;
     }
-    result_header.ingredients.push_back("recipe:"+curr->name);
+    result_header.ingredients.push_back(next_recipe_reagent(curr));
   }
   for (; curr; curr=curr->right)
-    result_header.products.push_back("recipe:"+curr->name);
+    result_header.products.push_back(next_recipe_reagent(curr));
   return result_header;
 }
 
+reagent next_recipe_reagent(const type_tree* curr) {
+  if (!curr->left) return reagent("recipe:"+curr->name);
+  reagent result;
+  result.name = "recipe";
+  result.type = new type_tree(*curr->left);
+  return result;
+}
+
 bool is_mu_recipe(const reagent& r) {
   if (!r.type) return false;
   if (r.type->name == "recipe") return true;
@@ -196,6 +204,19 @@ if (is_mu_recipe(to)) {
   return true;
 }
 
+:(scenario call_variable_compound_ingredient)
+def main [
+  {1: (recipe (address number) -> number)} <- copy f
+  2:address:number <- copy 0
+  3:number <- call {1: (recipe (address number) -> number)}, 2:address:number
+]
+def f x:address:number -> y:number [
+  local-scope
+  load-ingredients
+  y <- copy x
+]
+$error: 0
+
 //: make sure we don't accidentally break on a function literal
 :(scenario jump_forbidden_on_recipe_literals)
 % Hide_errors = true;