about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-12-03 18:19:40 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-12-03 18:19:40 -0800
commit3eb21f0e9d6c1fcc7e6201efa499759b68d82702 (patch)
tree7060afa8632f4755eb756cc52a77515f3b9c2a22
parent9ae92a0dbc19c3cbbbf774a1d4f7eb82095a0e2a (diff)
downloadmu-3eb21f0e9d6c1fcc7e6201efa499759b68d82702.tar.gz
393 - 'defer' should now support all kinds of exits
-rw-r--r--mu.arc5
-rw-r--r--mu.arc.t22
2 files changed, 26 insertions, 1 deletions
diff --git a/mu.arc b/mu.arc
index c59a1010..9fbb642b 100644
--- a/mu.arc
+++ b/mu.arc
@@ -924,9 +924,12 @@
               nil  ; skip
             (is instr.0 'reply)
               (do
+                (when cdr.instr  ; return values
+                  (= instr.0 'prepare-reply)
+                  (yield instr))
                 (each instr (as cons deferred)
                   (yield instr))
-                (yield instr))
+                (yield '(reply)))
             :else
               (yield instr)))
       (each instr (as cons deferred)
diff --git a/mu.arc.t b/mu.arc.t
index a7e87147..6b16d129 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -2798,6 +2798,28 @@
   (prn "F - convert-quotes inserts code at early exits"))
 
 (reset)
+(new-trace "convert-quotes-defer-reply-arg")
+(= traces* (queue))
+(if (~iso (convert-quotes
+            '(((1 integer) <- copy (0 literal))
+              (defer [
+                       ((5 integer) <- copy (0 literal))
+                     ])
+              ((2 integer) <- copy (0 literal))
+              (reply (2 literal))
+              ((3 integer) <- copy (0 literal))
+              ((4 integer) <- copy (0 literal))))
+          '(((1 integer) <- copy (0 literal))
+            ((2 integer) <- copy (0 literal))
+            (prepare-reply (2 literal))
+            ((5 integer) <- copy (0 literal))
+            (reply)
+            ((3 integer) <- copy (0 literal))
+            ((4 integer) <- copy (0 literal))
+            ((5 integer) <- copy (0 literal))))
+  (prn "F - convert-quotes inserts code at early exits"))
+
+(reset)
 (new-trace "convert-quotes-label")
 (= traces* (queue))
 (if (~iso (convert-quotes
5' href='#n215'>215 216 217 218 219 220 221 222