aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/tool/compiler/phase/generation/js/case.lux16
1 files changed, 15 insertions, 1 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux b/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux
index 0bafcd3c0..b8a0cd00d 100644
--- a/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux
+++ b/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux
@@ -69,9 +69,13 @@
(-> Expression Statement)
(_.statement (|> @cursor (_.do "push" (list value)))))
+(def: peek-and-pop-cursor
+ Expression
+ (|> @cursor (_.do "pop" (list))))
+
(def: pop-cursor!
Statement
- (_.statement (|> @cursor (_.do "pop" (list)))))
+ (_.statement ..peek-and-pop-cursor))
(def: peek-cursor
Expression
@@ -130,6 +134,16 @@
([synthesis.member/left //runtime.product//left (<|)]
[synthesis.member/right //runtime.product//right inc])
+ (^ ($_ synthesis.path/seq
+ (#synthesis.Bind register)
+ #synthesis.Pop
+ thenP))
+ (do ////.monad
+ [then! (pattern-matching' generate thenP)]
+ (/////wrap ($_ _.then
+ (_.define (..register register) ..peek-and-pop-cursor)
+ then!)))
+
(^template [<tag> <computation>]
(^ (<tag> leftP rightP))
(do ////.monad