aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang')
-rw-r--r--new-luxc/source/luxc/lang/analysis/procedure/common.lux2
-rw-r--r--new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux2
-rw-r--r--new-luxc/source/luxc/lang/translation/runtime.jvm.lux64
3 files changed, 34 insertions, 34 deletions
diff --git a/new-luxc/source/luxc/lang/analysis/procedure/common.lux b/new-luxc/source/luxc/lang/analysis/procedure/common.lux
index 3688f990e..f5756f35b 100644
--- a/new-luxc/source/luxc/lang/analysis/procedure/common.lux
+++ b/new-luxc/source/luxc/lang/analysis/procedure/common.lux
@@ -272,7 +272,7 @@
(install "replace-once" (trinary Text Text Text Text))
(install "replace-all" (trinary Text Text Text Text))
(install "char" (binary Text Nat (type (Maybe Nat))))
- (install "clip" (trinary Text Nat Nat Text))
+ (install "clip" (trinary Text Nat Nat (type (Maybe Text))))
)))
(def: (array-get proc)
diff --git a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux
index 9fd2df62f..9a01622ae 100644
--- a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux
@@ -423,7 +423,7 @@
[text//clip ($i;CHECKCAST "java.lang.String") jvm-intI jvm-intI
($i;INVOKESTATIC hostL;runtime-class "text_clip"
- ($t;method (list $String $t;int $t;int) (#;Some $Object-Array) (list)) false)]
+ ($t;method (list $String $t;int $t;int) (#;Some $Variant) (list)) false)]
[text//replace-once ($i;CHECKCAST "java.lang.String")
(<| ($i;INVOKESTATIC "java.util.regex.Pattern" "quote" ($t;method (list $String) (#;Some $String) (list)) false)
($i;CHECKCAST "java.lang.String"))
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