aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux42
1 files changed, 21 insertions, 21 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux
index f5799e572..70eedf738 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/function.jvm.lux
@@ -39,7 +39,7 @@
(if (poly-arg? arity)
($t.method (list.concat (list (captured-args env)
(list $t.int)
- (list.repeat (n/dec arity) $Object)))
+ (list.repeat (dec arity) $Object)))
#.None
(list))
($t.method (captured-args env) #.None (list))))
@@ -59,7 +59,7 @@
(def: (inputsI start amount)
(-> $.Register Nat $.Inst)
- (|> (list.n/range start (n/+ start (n/dec amount)))
+ (|> (list.n/range start (n/+ start (dec amount)))
(list/map $i.ALOAD)
$i.fuse))
@@ -76,7 +76,7 @@
(def: (inc-intI by)
(-> Nat $.Inst)
- (|>> ($i.int (nat-to-int by))
+ (|>> ($i.int (.int by))
$i.IADD))
(def: (nullsI amount)
@@ -106,7 +106,7 @@
(do macro.Monad<Meta>
[captureI+ (monad.map @ referenceT.translate-variable env)
#let [argsI (if (poly-arg? arity)
- (|> (nullsI (n/dec arity))
+ (|> (nullsI (dec arity))
(list ($i.int 0))
$i.fuse)
id)]]
@@ -123,12 +123,12 @@
(let [env-size (list.size env)
captureI (|> (case env-size
+0 (list)
- _ (list.n/range +0 (n/dec env-size)))
+ _ (list.n/range +0 (dec env-size)))
(list/map (function (_ source)
(|>> ($i.ALOAD +0)
($i.GETFIELD class (referenceT.captured source) $Object))))
$i.fuse)
- argsI (|> (nullsI (n/dec arity))
+ argsI (|> (nullsI (dec arity))
(list ($i.int 0))
$i.fuse)]
(|>> ($i.NEW class)
@@ -156,20 +156,20 @@
(if (n/= +1 arity)
(|>> ($i.int 0)
($i.INVOKESPECIAL hostL.function-class "<init>" function-init-method false))
- (|>> ($i.ILOAD (n/inc env-size))
+ (|>> ($i.ILOAD (inc env-size))
($i.INVOKESPECIAL hostL.function-class "<init>" function-init-method false))))
(def: (with-init class env arity)
(-> Text (List Variable) ls.Arity $.Def)
(let [env-size (list.size env)
offset-partial (: (-> Nat Nat)
- (|>> n/inc (n/+ env-size)))
+ (|>> inc (n/+ env-size)))
store-capturedI (|> (case env-size
+0 (list)
- _ (list.n/range +0 (n/dec env-size)))
+ _ (list.n/range +0 (dec env-size)))
(list/map (function (_ register)
(|>> ($i.ALOAD +0)
- ($i.ALOAD (n/inc register))
+ ($i.ALOAD (inc register))
($i.PUTFIELD class (referenceT.captured register) $Object))))
$i.fuse)
store-partialI (if (poly-arg? arity)
@@ -177,7 +177,7 @@
(list/map (function (_ idx)
(let [register (offset-partial idx)]
(|>> ($i.ALOAD +0)
- ($i.ALOAD (n/inc register))
+ ($i.ALOAD (inc register))
($i.PUTFIELD class (referenceT.partial idx) $Object)))))
$i.fuse)
id)]
@@ -191,19 +191,19 @@
(def: (with-apply class env function-arity @begin bodyI apply-arity)
(-> Text (List Variable) ls.Arity $.Label $.Inst ls.Arity
$.Def)
- (let [num-partials (n/dec function-arity)
+ (let [num-partials (dec function-arity)
@default ($.new-label [])
@labels (list/map $.new-label (list.repeat num-partials []))
- arity-over-extent (|> (nat-to-int function-arity) (i/- (nat-to-int apply-arity)))
+ arity-over-extent (|> (.int function-arity) (i/- (.int apply-arity)))
casesI (|> (list/compose @labels (list @default))
(list.zip2 (list.n/range +0 num-partials))
(list/map (function (_ [stage @label])
(let [load-partialsI (if (n/> +0 stage)
- (|> (list.n/range +0 (n/dec stage))
+ (|> (list.n/range +0 (dec stage))
(list/map (|>> referenceT.partial (load-fieldI class)))
$i.fuse)
id)]
- (cond (i/= arity-over-extent (nat-to-int stage))
+ (cond (i/= arity-over-extent (.int stage))
(|>> ($i.label @label)
($i.ALOAD +0)
(when (n/> +0 stage)
@@ -213,7 +213,7 @@
($i.INVOKEVIRTUAL class "impl" (implementation-method function-arity) false)
$i.ARETURN)
- (i/> arity-over-extent (nat-to-int stage))
+ (i/> arity-over-extent (.int stage))
(let [args-to-completion (|> function-arity (n/- stage))
args-left (|> apply-arity (n/- args-to-completion))]
(|>> ($i.label @label)
@@ -222,14 +222,14 @@
load-partialsI
(inputsI +1 args-to-completion)
($i.INVOKEVIRTUAL class "impl" (implementation-method function-arity) false)
- (applysI (n/inc args-to-completion) args-left)
+ (applysI (inc args-to-completion) args-left)
$i.ARETURN))
- ## (i/< arity-over-extent (nat-to-int stage))
+ ## (i/< arity-over-extent (.int stage))
(let [env-size (list.size env)
load-capturedI (|> (case env-size
+0 (list)
- _ (list.n/range +0 (n/dec env-size)))
+ _ (list.n/range +0 (dec env-size)))
(list/map (|>> referenceT.captured (load-fieldI class)))
$i.fuse)]
(|>> ($i.label @label)
@@ -247,7 +247,7 @@
$i.fuse)]
($d.method #$.Public $.noneM runtimeT.apply-method (runtimeT.apply-signature apply-arity)
(|>> get-amount-of-partialsI
- ($i.TABLESWITCH 0 (|> num-partials n/dec nat-to-int)
+ ($i.TABLESWITCH 0 (|> num-partials dec .int)
@default @labels)
casesI
($i.INVOKESTATIC hostL.runtime-class "apply_fail" ($t.method (list) #.None (list)) false)
@@ -271,7 +271,7 @@
bodyI
$i.ARETURN))))
functionD (: $.Def
- (|>> ($d.int-field #$.Public ($_ $.++F $.staticF $.finalF) arity-field (nat-to-int arity))
+ (|>> ($d.int-field #$.Public ($_ $.++F $.staticF $.finalF) arity-field (.int arity))
(with-captured env)
(with-partial arity)
(with-init class env arity)