aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/function.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/function.jvm.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/function.jvm.lux15
1 files changed, 8 insertions, 7 deletions
diff --git a/new-luxc/source/luxc/lang/translation/function.jvm.lux b/new-luxc/source/luxc/lang/translation/function.jvm.lux
index ebdb28853..1b7f6267b 100644
--- a/new-luxc/source/luxc/lang/translation/function.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/function.jvm.lux
@@ -1,7 +1,8 @@
(;module:
lux
(lux (control [monad #+ do])
- (data text/format
+ (data [text]
+ text/format
(coll [list "list/" Functor<List> Monoid<List>]))
[meta])
(luxc ["&" base]
@@ -266,13 +267,11 @@
$i;ARETURN
))))
-(def: #export (with-function translate class env arity body)
- (-> (-> ls;Synthesis (Meta $;Inst))
- Text (List Variable) ls;Arity ls;Synthesis
+(def: #export (with-function class env arity bodyI)
+ (-> Text (List Variable) ls;Arity $;Inst
(Meta [$;Def $;Inst]))
(do meta;Monad<Meta>
[@begin $i;make-label
- bodyI (commonT;with-function class (translate body))
#let [env-size (list;size env)
applyD (: $;Def
(if (poly-arg? arity)
@@ -300,8 +299,10 @@
(List Variable) ls;Arity ls;Synthesis
(Meta $;Inst))
(do meta;Monad<Meta>
- [function-class (:: @ map %code (meta;gensym "function"))
- [functionD instanceI] (with-function translate function-class env arity body)
+ [[context bodyI] (hostL;with-sub-context
+ (translate body))
+ #let [function-class (text;replace-all "/+" "$" context)]
+ [functionD instanceI] (with-function function-class env arity bodyI)
_ (commonT;store-class function-class
($d;class #$;V1.6 #$;Public $;finalC
function-class (list)