about summary refs log tree commit diff stats
path: root/045closure_name.cc
diff options
context:
space:
mode:
Diffstat (limited to '045closure_name.cc')
-rw-r--r--045closure_name.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/045closure_name.cc b/045closure_name.cc
index 48a84442..1c365f2e 100644
--- a/045closure_name.cc
+++ b/045closure_name.cc
@@ -156,3 +156,23 @@ def f [
 ]
 +error: don't know surrounding recipe of f
 +error: f: can't find a place to store x
+
+//: extra test for try_reclaim_locals() from previous layers
+:(scenario local_scope_ignores_nonlocal_spaces)
+def new-scope [
+  new-default-space
+  x:address:number <- new number:type
+  *x:address:number <- copy 34
+  return default-space:address:array:location
+]
+def use-scope [
+  local-scope
+  outer:address:array:location <- next-ingredient
+  0:address:array:location/names:new-scope <- copy outer:address:array:location
+  return *x:address:number/space:1
+]
+def main [
+  1:address:array:location/raw <- new-scope
+  2:number/raw <- use-scope 1:address:array:location/raw
+]
++mem: storing 34 in location 2