aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/ffi.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/ffi.jvm.lux')
-rw-r--r--stdlib/source/lux/ffi.jvm.lux20
1 files changed, 18 insertions, 2 deletions
diff --git a/stdlib/source/lux/ffi.jvm.lux b/stdlib/source/lux/ffi.jvm.lux
index 4e684acf5..69a9ea5a3 100644
--- a/stdlib/source/lux/ffi.jvm.lux
+++ b/stdlib/source/lux/ffi.jvm.lux
@@ -1358,8 +1358,8 @@
(syntax: #export (do_to obj {methods (<>.some partial_call^)})
{#.doc (doc "Call a variety of methods on an object. Then, return the object."
(do_to object
- (ClassName::method1 arg0 arg1 arg2)
- (ClassName::method2 arg3 arg4 arg5)))}
+ (ClassName::method1 arg0 arg1 arg2)
+ (ClassName::method2 arg3 arg4 arg5)))}
(with_gensyms [g!obj]
(wrap (list (` (let [(~ g!obj) (~ obj)]
(exec (~+ (list\map (complete_call$ g!obj) methods))
@@ -2023,3 +2023,19 @@
(syntax: #export (type {type (..type^ (list))})
(wrap (list (value_type #ManualPrM type))))
+
+(exception: #export (cannot_cast_to_non_object {type (Type Value)})
+ (exception.report
+ ["Signature" (..signature type)]
+ ["Reflection" (..reflection type)]))
+
+(syntax: #export (:as {type (..type^ (list))}
+ object)
+ (case [(parser.array? type)
+ (parser.class? type)]
+ (^or [(#.Some _) _] [_ (#.Some _)])
+ (wrap (list (` (.: (~ (..value_type #ManualPrM type))
+ ("jvm object cast" (~ object))))))
+
+ _
+ (meta.fail (exception.construct ..cannot_cast_to_non_object [type]))))