aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/runtime.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/runtime.jvm.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/runtime.jvm.lux64
1 files changed, 32 insertions, 32 deletions
diff --git a/new-luxc/source/luxc/lang/translation/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/runtime.jvm.lux
index cc17014e1..70450be91 100644
--- a/new-luxc/source/luxc/lang/translation/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/runtime.jvm.lux
@@ -91,6 +91,21 @@
($i;string hostL;unit)
variantI))
+(def: (try-methodI unsafeI)
+ (-> $;Inst $;Inst)
+ (<| $i;with-label (function [@from])
+ $i;with-label (function [@to])
+ $i;with-label (function [@handler])
+ (|>. ($i;try @from @to @handler "java.lang.Exception")
+ ($i;label @from)
+ unsafeI
+ someI
+ $i;ARETURN
+ ($i;label @to)
+ ($i;label @handler)
+ noneI
+ $i;ARETURN)))
+
(def: #export string-concatI
$;Inst
($i;INVOKEVIRTUAL "java.lang.String" "concat" ($t;method (list $String) (#;Some $String) (list)) false))
@@ -271,20 +286,10 @@
(def: frac-methods
$;Def
(|>. ($d;method #$;Public $;staticM "decode_frac" ($t;method (list $String) (#;Some $Object-Array) (list))
- (<| $i;with-label (function [@from])
- $i;with-label (function [@to])
- $i;with-label (function [@handler])
- (|>. ($i;try @from @to @handler "java.lang.Exception")
- ($i;label @from)
- ($i;ALOAD +0)
- ($i;INVOKESTATIC "java.lang.Double" "parseDouble" ($t;method (list $String) (#;Some $t;double) (list)) false)
- ($i;wrap #$;Double)
- someI
- $i;ARETURN
- ($i;label @to)
- ($i;label @handler)
- noneI
- $i;ARETURN)))
+ (try-methodI
+ (|>. ($i;ALOAD +0)
+ ($i;INVOKESTATIC "java.lang.Double" "parseDouble" ($t;method (list $String) (#;Some $t;double) (list)) false)
+ ($i;wrap #$;Double))))
($d;method #$;Public $;staticM "frac_to_deg" ($t;method (list $t;double) (#;Some $t;long) (list))
(let [swap2 (|>. $i;DUP2_X2 $i;POP2)
drop-excessI (|>. ($i;double 1.0) $i;DREM)
@@ -388,24 +393,19 @@
(def: text-methods
$;Def
- (|>. ($d;method #$;Public $;staticM "text_char" ($t;method (list $String $t;int) (#;Some $Variant) (list))
- (let [get-charI (|>. ($i;ALOAD +0)
- ($i;ILOAD +1)
- ($i;INVOKEVIRTUAL "java.lang.String" "codePointAt" ($t;method (list $t;int) (#;Some $t;int) (list)) false)
- $i;I2L
- ($i;wrap #$;Long))]
- (<| $i;with-label (function [@from])
- $i;with-label (function [@to])
- $i;with-label (function [@handler])
- (|>. ($i;try @from @to @handler "java.lang.Exception")
- ($i;label @from)
- get-charI
- someI
- $i;ARETURN
- ($i;label @to)
- ($i;label @handler)
- noneI
- $i;ARETURN))))
+ (|>. ($d;method #$;Public $;staticM "text_clip" ($t;method (list $String $t;int $t;int) (#;Some $Variant) (list))
+ (try-methodI
+ (|>. ($i;ALOAD +0)
+ ($i;ILOAD +1)
+ ($i;ILOAD +2)
+ ($i;INVOKEVIRTUAL "java.lang.String" "substring" ($t;method (list $t;int $t;int) (#;Some $String) (list)) false))))
+ ($d;method #$;Public $;staticM "text_char" ($t;method (list $String $t;int) (#;Some $Variant) (list))
+ (try-methodI
+ (|>. ($i;ALOAD +0)
+ ($i;ILOAD +1)
+ ($i;INVOKEVIRTUAL "java.lang.String" "codePointAt" ($t;method (list $t;int) (#;Some $t;int) (list)) false)
+ $i;I2L
+ ($i;wrap #$;Long))))
))
(def: pm-methods