aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/target/jvm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/target/jvm/bytecode.lux16
-rw-r--r--stdlib/source/lux/target/jvm/constant.lux2
-rw-r--r--stdlib/source/lux/target/jvm/loader.lux42
-rw-r--r--stdlib/source/lux/target/jvm/reflection.lux8
-rw-r--r--stdlib/source/lux/target/jvm/type.lux8
5 files changed, 38 insertions, 38 deletions
diff --git a/stdlib/source/lux/target/jvm/bytecode.lux b/stdlib/source/lux/target/jvm/bytecode.lux
index 503970d6a..551b51087 100644
--- a/stdlib/source/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/lux/target/jvm/bytecode.lux
@@ -154,7 +154,7 @@
(def: #export monad
(Monad Bytecode)
- (<| (:coerce (Monad Bytecode))
+ (<| (:as (Monad Bytecode))
(writer.with ..relative_monoid)
(: (Monad (State' Try [Pool Environment Tracker])))
state.with
@@ -508,17 +508,17 @@
(-> java/lang/Float Int)
(|>> java/lang/Float::floatToRawIntBits
ffi.int_to_long
- (:coerce Int)))
+ (:as Int)))
(def: negative_zero_float_bits
- (|> -0.0 (:coerce java/lang/Double) ffi.double_to_float ..float_bits))
+ (|> -0.0 (:as java/lang/Double) ffi.double_to_float ..float_bits))
(def: #export (float value)
(-> java/lang/Float (Bytecode Any))
(if (i.= ..negative_zero_float_bits
(..float_bits value))
(..arbitrary_float value)
- (case (|> value ffi.float_to_double (:coerce Frac))
+ (case (|> value ffi.float_to_double (:as Frac))
(^template [<special> <instruction>]
[<special> (..bytecode $0 $1 @_ <instruction> [])])
([+0.0 _.fconst_0]
@@ -548,23 +548,23 @@
(def: (arbitrary_double value)
(-> java/lang/Double (Bytecode Any))
(do ..monad
- [index (..lift (//constant/pool.double (//constant.double (:coerce Frac value))))]
+ [index (..lift (//constant/pool.double (//constant.double (:as Frac value))))]
(..bytecode $0 $2 @_ _.ldc2_w/double [index])))
(def: double_bits
(-> java/lang/Double Int)
(|>> java/lang/Double::doubleToRawLongBits
- (:coerce Int)))
+ (:as Int)))
(def: negative_zero_double_bits
- (..double_bits (:coerce java/lang/Double -0.0)))
+ (..double_bits (:as java/lang/Double -0.0)))
(def: #export (double value)
(-> java/lang/Double (Bytecode Any))
(if (i.= ..negative_zero_double_bits
(..double_bits value))
(..arbitrary_double value)
- (case (:coerce Frac value)
+ (case (:as Frac value)
(^template [<special> <instruction>]
[<special> (..bytecode $0 $2 @_ <instruction> [])])
([+0.0 _.dconst_0]
diff --git a/stdlib/source/lux/target/jvm/constant.lux b/stdlib/source/lux/target/jvm/constant.lux
index d0280cb27..651f667ee 100644
--- a/stdlib/source/lux/target/jvm/constant.lux
+++ b/stdlib/source/lux/target/jvm/constant.lux
@@ -118,7 +118,7 @@
(~~ (template.splice <writer>)))))]
[integer_writer Integer [] [binaryF.bits/32]]
- [float_writer Float [java/lang/Float::floatToRawIntBits ffi.int_to_long (:coerce I64)] [i32.i32 binaryF.bits/32]]
+ [float_writer Float [java/lang/Float::floatToRawIntBits ffi.int_to_long (:as I64)] [i32.i32 binaryF.bits/32]]
[long_writer Long [] [binaryF.bits/64]]
[double_writer Double [java/lang/Double::doubleToRawLongBits] [binaryF.bits/64]]
[string_writer String [] [//index.writer]]
diff --git a/stdlib/source/lux/target/jvm/loader.lux b/stdlib/source/lux/target/jvm/loader.lux
index 755f9526e..4ca391382 100644
--- a/stdlib/source/lux/target/jvm/loader.lux
+++ b/stdlib/source/lux/target/jvm/loader.lux
@@ -66,33 +66,33 @@
(def: java/lang/ClassLoader::defineClass
java/lang/reflect/Method
(let [signature (|> (ffi.array <elemT> 4)
- (ffi.array_write 0 (:coerce <elemT>
- (ffi.class_for java/lang/String)))
+ (ffi.array_write 0 (:as <elemT>
+ (ffi.class_for java/lang/String)))
(ffi.array_write 1 (java/lang/Object::getClass (ffi.array byte 0)))
- (ffi.array_write 2 (:coerce <elemT>
- (java/lang/Integer::TYPE)))
- (ffi.array_write 3 (:coerce <elemT>
- (java/lang/Integer::TYPE))))]
+ (ffi.array_write 2 (:as <elemT>
+ (java/lang/Integer::TYPE)))
+ (ffi.array_write 3 (:as <elemT>
+ (java/lang/Integer::TYPE))))]
(do_to (java/lang/Class::getDeclaredMethod "defineClass"
signature
(ffi.class_for java/lang/ClassLoader))
- (java/lang/reflect/AccessibleObject::setAccessible true)))))
+ (java/lang/reflect/AccessibleObject::setAccessible true)))))
(def: #export (define class_name bytecode loader)
(-> Text Binary java/lang/ClassLoader (Try java/lang/Object))
- (let [signature (array.from_list (list (:coerce java/lang/Object
- class_name)
- (:coerce java/lang/Object
- bytecode)
- (:coerce java/lang/Object
- (|> 0
- (:coerce (primitive "java.lang.Long"))
- ffi.long_to_int))
- (:coerce java/lang/Object
- (|> bytecode
- binary.size
- (:coerce (primitive "java.lang.Long"))
- ffi.long_to_int))))]
+ (let [signature (array.from_list (list (:as java/lang/Object
+ class_name)
+ (:as java/lang/Object
+ bytecode)
+ (:as java/lang/Object
+ (|> 0
+ (:as (primitive "java.lang.Long"))
+ ffi.long_to_int))
+ (:as java/lang/Object
+ (|> bytecode
+ binary.size
+ (:as (primitive "java.lang.Long"))
+ ffi.long_to_int))))]
(java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass)))
(def: #export (new_library _)
@@ -112,7 +112,7 @@
(java/lang/ClassLoader (findClass self {class_name java/lang/String})
(java/lang/Class [? < java/lang/Object])
#throws [java/lang/ClassNotFoundException]
- (let [class_name (:coerce Text class_name)
+ (let [class_name (:as Text class_name)
classes (|> library atom.read io.run)]
(case (dictionary.get class_name classes)
(#.Some bytecode)
diff --git a/stdlib/source/lux/target/jvm/reflection.lux b/stdlib/source/lux/target/jvm/reflection.lux
index 07afd5df0..02c6b0ab0 100644
--- a/stdlib/source/lux/target/jvm/reflection.lux
+++ b/stdlib/source/lux/target/jvm/reflection.lux
@@ -145,7 +145,7 @@
(<| (case (ffi.check java/lang/Class reflection)
(#.Some class)
(let [class_name (|> class
- (:coerce (java/lang/Class java/lang/Object))
+ (:as (java/lang/Class java/lang/Object))
java/lang/Class::getName)]
(`` (if (or (~~ (template [<reflection>]
[(text\= (/reflection.reflection <reflection>)
@@ -174,7 +174,7 @@
array.to_list
(monad.map ! parameter))]
(wrap (/.class (|> raw
- (:coerce (java/lang/Class java/lang/Object))
+ (:as (java/lang/Class java/lang/Object))
java/lang/Class::getName)
paramsT)))
@@ -224,7 +224,7 @@
(<| (case (ffi.check java/lang/Class reflection)
(#.Some reflection)
(let [class_name (|> reflection
- (:coerce (java/lang/Class java/lang/Object))
+ (:as (java/lang/Class java/lang/Object))
java/lang/Class::getName)]
(`` (cond (~~ (template [<reflection> <type>]
[(text\= (/reflection.reflection <reflection>)
@@ -259,7 +259,7 @@
(case (ffi.check java/lang/Class reflection)
(#.Some class)
(let [class_name (|> reflection
- (:coerce (java/lang/Class java/lang/Object))
+ (:as (java/lang/Class java/lang/Object))
java/lang/Class::getName)]
(if (text\= (/reflection.reflection /reflection.void)
class_name)
diff --git a/stdlib/source/lux/target/jvm/type.lux b/stdlib/source/lux/target/jvm/type.lux
index 38645ef06..0e3d9be92 100644
--- a/stdlib/source/lux/target/jvm/type.lux
+++ b/stdlib/source/lux/target/jvm/type.lux
@@ -170,8 +170,8 @@
[..float]
[..double]
[..char]))))
- (|> type (:coerce (Type Primitive)) #.Right)
- (|> type (:coerce (Type Object)) #.Left)))
+ (|> type (:as (Type Primitive)) #.Right)
+ (|> type (:as (Type Object)) #.Left)))
(def: #export (void? type)
(-> (Type Return) (Either (Type Value)
@@ -180,8 +180,8 @@
[(\ ..equivalence = (: (Type Return) <type>) type)]
[..void]))))
- (|> type (:coerce (Type Void)) #.Right)
- (|> type (:coerce (Type Value)) #.Left)))
+ (|> type (:as (Type Void)) #.Right)
+ (|> type (:as (Type Value)) #.Left)))
)
(def: #export (class? type)