about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--mu.arc9
-rw-r--r--mu.arc.t14
2 files changed, 19 insertions, 4 deletions
diff --git a/mu.arc b/mu.arc
index df6aff2a..723925c6 100644
--- a/mu.arc
+++ b/mu.arc
@@ -150,10 +150,11 @@
 
 (def addr (loc)
   (ret result v.loc
-    (whenlet base rep.routine*!default-scope
-      (if (< result memory*.base)
-         (++ result base)
-         (die "addr: no room for var @result")))
+    (unless (pos 'global metadata.loc)
+      (whenlet base rep.routine*!default-scope
+        (if (< result memory*.base)
+           (++ result base)
+           (die "addr: no room for var @result"))))
     (when (pos 'deref metadata.loc)
       (zap memory* result))))
 
diff --git a/mu.arc.t b/mu.arc.t
index 6e8a0ad7..57e806d9 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -1443,4 +1443,18 @@
             ((default-scope integer) <- add (1 integer) (2 integer))))
   (prn "F - convert-names never renames default-scope"))
 
+(reset)
+(new-trace "suppress-default-scope")
+(add-fns
+  '((main
+      ((default-scope scope-address) <- new (scope literal) (2 literal))
+      ((1 integer global) <- copy (23 literal)))))
+(let before Memory-in-use-until
+;?   (set dump-trace*)
+  (run 'main)
+;?   (prn memory*)
+  (if (~and (is 23 memory*.1)
+            (~is 23 (memory* (+ before 1))))
+    (prn "F - default-scope skipped for locations with metadata 'global'")))
+
 (reset)  ; end file with this to persist the trace for the final test