(;module:
lux
(lux (control [monad #+ do])
(data text/format)
[meta "meta/" Monad])
(luxc (lang ["ls" synthesis])
(generator [";G" common]
[";G" function]
(host ["$" jvm]
(jvm ["$t" type]
["$i" inst])))))
(def: $Object $;Type ($t;class "java.lang.Object" (list)))
(def: #export (generate-captured variable)
(-> ls;Variable (Meta $;Inst))
(do meta;Monad
[function-class commonG;function]
(wrap (|>. ($i;ALOAD +0)
($i;GETFIELD function-class
(|> variable i.inc (i.* -1) int-to-nat functionG;captured)
$Object)))))
(def: #export (generate-variable variable)
(-> ls;Variable (Meta $;Inst))
(meta/wrap ($i;ALOAD (int-to-nat variable))))