diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-12-07 10:53:42 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-12-07 10:53:42 -0800 |
commit | f4f26d5878810534eb3c154b1fd52feb29cd3521 (patch) | |
tree | 76596c078ecab7285f3e49f60bac77b1d5fbfb17 /072recipe.cc | |
parent | b90121dae804b2b145779cf1ca6e32cd8c7ce77d (diff) | |
download | mu-f4f26d5878810534eb3c154b1fd52feb29cd3521.tar.gz |
4144
Diffstat (limited to '072recipe.cc')
-rw-r--r-- | 072recipe.cc | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/072recipe.cc b/072recipe.cc index f77949e1..34b49b3f 100644 --- a/072recipe.cc +++ b/072recipe.cc @@ -15,18 +15,6 @@ def f x:num -> y:num [ ] +mem: storing 34 in location 1 -:(scenario call_variable) -def main [ - {1: (recipe number -> number)} <- copy f - 2:num <- call {1: (recipe number -> number)}, 34 -] -def f x:num -> y:num [ - local-scope - load-ingredients - y <- copy x -] -+mem: storing 34 in location 2 - :(before "End Mu Types Initialization") put(Type_ordinal, "recipe-literal", 0); // 'recipe' variables can store recipe-literal @@ -130,6 +118,29 @@ case CALL: { break; } +:(scenario call_variable) +def main [ + {1: (recipe number -> number)} <- copy f + 2:num <- call {1: (recipe number -> number)}, 34 +] +def f x:num -> y:num [ + local-scope + load-ingredients + y <- copy x +] ++mem: storing 34 in location 2 + +:(scenario call_shape_shifting_recipe) +def main [ + 1:num <- call f, 34 +] +def f x:_elem -> y:_elem [ + local-scope + load-ingredients + y <- copy x +] ++mem: storing 34 in location 1 + //:: check types for 'call' instructions :(scenario call_check_literal_recipe) @@ -159,17 +170,6 @@ def f x:point -> y:point [ +error: main: ingredient 0 has the wrong type at '2:num <- call {1: (recipe point -> point)}, 34' +error: main: product 0 has the wrong type at '2:num <- call {1: (recipe point -> point)}, 34' -:(scenario call_check_shape_shifting_recipe) -def main [ - 1:num <- call f, 34 -] -def f x:_elem -> y:_elem [ - local-scope - load-ingredients - y <- copy x -] -+mem: storing 34 in location 1 - :(before "End resolve_ambiguous_call(r, index, inst, caller_recipe) Special-cases") if (inst.name == "call" && !inst.ingredients.empty() && inst.ingredients.at(0).type && inst.ingredients.at(0).type->atom && inst.ingredients.at(0).type->name == "recipe-literal") { instruction inst2; |