aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/js/loop.jvm.lux35
1 files changed, 0 insertions, 35 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/js/loop.jvm.lux
deleted file mode 100644
index c63cb2d32..000000000
--- a/new-luxc/source/luxc/lang/translation/js/loop.jvm.lux
+++ /dev/null
@@ -1,35 +0,0 @@
-(.module:
- lux
- (lux (control [monad #+ do])
- (data [text]
- text/format
- (coll [list "list/" Functor<List>]))
- [macro])
- (luxc [lang]
- (lang ["ls" synthesis]
- (host [js #+ JS Expression Statement])))
- [//]
- (// [".T" reference]))
-
-(def: #export (translate-loop translate offset initsS+ bodyS)
- (-> (-> ls.Synthesis (Meta Expression)) Nat (List ls.Synthesis) ls.Synthesis
- (Meta Expression))
- (do macro.Monad<Meta>
- [loop-name (:: @ map (|>> %code lang.normalize-name)
- (macro.gensym "loop"))
- initsJS+ (monad.map @ translate initsS+)
- bodyJS (//.with-anchor [loop-name offset]
- (translate bodyS))
- #let [registersJS+ (|> (list.n/range +0 (dec (list.size initsS+)))
- (list/map (|>> (n/+ offset) referenceT.variable)))]]
- (wrap (format "(function " loop-name "(" (text.join-with "," registersJS+) ") {"
- "return " bodyJS ";"
- "})(" (text.join-with "," initsJS+) ")"))))
-
-(def: #export (translate-recur translate argsS+)
- (-> (-> ls.Synthesis (Meta Expression)) (List ls.Synthesis)
- (Meta Expression))
- (do macro.Monad<Meta>
- [[loop-name offset] //.anchor
- argsJS+ (monad.map @ translate argsS+)]
- (wrap (format loop-name "(" (text.join-with "," argsJS+) ")"))))