aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/ffi.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux92
1 files changed, 46 insertions, 46 deletions
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index b244493a6..be31fd27a 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -333,7 +333,7 @@
(def (primitive_type mode type)
(-> Primitive_Mode (Type Primitive) Code)
- (case mode
+ (when mode
{#ManualPrM}
(cond (at jvm.equivalence = jvm.boolean type) (` ..Boolean)
(at jvm.equivalence = jvm.byte type) (` ..Byte)
@@ -370,7 +370,7 @@
(-> (-> (Type Value) Code)
(-> (Type Parameter) Code))
(`` (<| (,, (with_template [<when> <binding> <then>]
- [(case (<when> type)
+ [(when (<when> type)
{.#Some <binding>}
<then>
@@ -384,7 +384,7 @@
(` (.Primitive (, (code.text name))
[(,* (list#each (parameter_type value_type) parameters))]))]
[parser.array? elementT
- (case (parser.primitive? elementT)
+ (when (parser.primitive? elementT)
{.#Some elementT}
(` {.#Primitive (, (code.text (..reflection (jvm.array elementT)))) {.#End}})
@@ -397,7 +397,7 @@
(def (value_type mode type)
(-> Primitive_Mode (Type Value) Code)
(`` (<| (,, (with_template [<when> <binding> <then>]
- [(case (<when> type)
+ [(when (<when> type)
{.#Some <binding>}
<then>
@@ -885,7 +885,7 @@
(def (privacy_modifier$ pm)
(-> Privacy Code)
- (case pm
+ (when pm
{#PublicP} (code.text "public")
{#PrivateP} (code.text "private")
{#ProtectedP} (code.text "protected")
@@ -893,7 +893,7 @@
(def (inheritance_modifier$ im)
(-> Inheritance Code)
- (case im
+ (when im
{#FinalI} (code.text "final")
{#AbstractI} (code.text "abstract")
{#DefaultI} (code.text "default")))
@@ -935,14 +935,14 @@
(def (state_modifier$ it)
(-> State Code)
- (case it
+ (when it
{#VolatileS} (' "volatile")
{#FinalS} (' "final")
{#DefaultS} (' "default")))
(def (field_decl$ [[name pm anns] field])
(-> [Member_Declaration FieldDecl] Code)
- (case field
+ (when field
{#ConstantField class value}
(` ("constant" (, (code.text name))
[(,* (list#each annotation$ anns))]
@@ -1126,9 +1126,9 @@
(list#each (function (_ [member field])
[(the #member_name member) [member field]]))
(dictionary.of_list text.hash))]]
- (case (dictionary.value field fields)
+ (when (dictionary.value field fields)
{.#Some [member {#VariableField _ static? :field:}]}
- (case [static? this]
+ (when [static? this]
[.true {.#None}]
(in (list (` ("jvm member get static"
(, (code.text class_name))
@@ -1156,14 +1156,14 @@
(list#each (function (_ [member field])
[(the #member_name member) [member field]]))
(dictionary.of_list text.hash))]]
- (case (dictionary.value field fields)
+ (when (dictionary.value field fields)
{.#Some [member {#VariableField state static? :field:}]}
- (case state
+ (when state
{#FinalS}
(meta.failure (exception.error ..cannot_set_field [class_name field]))
_
- (case [static? this]
+ (when [static? this]
[.true {.#None}]
(in (list (` ("jvm member put static"
(, (code.text class_name))
@@ -1210,7 +1210,7 @@
(list#each (function (_ [member virtual])
[(the #member_name member) [member virtual]]))
(dictionary.of_list text.hash))]]
- (case (dictionary.value method virtuals)
+ (when (dictionary.value method virtuals)
{.#Some [member method]}
(let [expected_arguments (list.size (the #method_inputs method))
actual_arguments (list.size inputs)]
@@ -1233,7 +1233,7 @@
(def (method_declaration [member definition])
(-> [Member_Declaration Method_Definition]
(Maybe [Member_Declaration MethodDecl]))
- (case definition
+ (when definition
{#VirtualMethod final? strict_fp? type_vars self_name arguments return_type body exs}
{.#Some [member
[#method_tvars type_vars
@@ -1247,14 +1247,14 @@
(def (method_def$ fully_qualified_class_name class_vars super_class fields methods [method_declaration method_def])
(-> External (List (Type Var)) (Type Class) (List [Member_Declaration FieldDecl]) (List [Member_Declaration Method_Definition]) [Member_Declaration Method_Definition] (Meta Code))
(let [[name pm anns] method_declaration
- virtual_methods (case (list.all ..method_declaration methods)
+ virtual_methods (when (list.all ..method_declaration methods)
{.#End}
(list)
virtual_methods
(list (` (..with_call [(, (declaration$ (jvm.declaration fully_qualified_class_name class_vars)))
[(,* (list#each method_decl$$ virtual_methods))]]))))]
- (case method_def
+ (when method_def
{#ConstructorMethod strict_fp? type_vars self_name arguments constructor_args body exs}
(meta#in (` ("init"
(, (privacy_modifier$ pm))
@@ -1426,7 +1426,7 @@
(def .public !!!
(syntax (_ [expr <code>.any])
(with_symbols [g!value]
- (in (list (` (.case (, expr)
+ (in (list (` (.when (, expr)
{.#Some (, g!value)}
(, g!value)
@@ -1444,7 +1444,7 @@
{.#Some (.as (, class_type)
(, g!unchecked))}
{.#None}))]
- (case unchecked
+ (when unchecked
{.#Some unchecked}
(in (list (` (.is (, check_type)
(let [(, g!unchecked) (, unchecked)]
@@ -1483,12 +1483,12 @@
(def (member_type_vars class_tvars member)
(-> (List (Type Var)) Import_Member_Declaration (List (Type Var)))
- (case member
+ (when member
{#ConstructorDecl [commons _]}
(list#composite class_tvars (the #import_member_tvars commons))
{#MethodDecl [commons _]}
- (case (the #import_member_kind commons)
+ (when (the #import_member_kind commons)
{#StaticIMK}
(the #import_member_tvars commons)
@@ -1500,7 +1500,7 @@
(def (member_def_arg_bindings vars member)
(-> (List (Type Var)) Import_Member_Declaration (Meta [(List [Bit Code]) (List (Type Value)) (List Code)]))
- (case member
+ (when member
(^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
(let [(open "[0]") commons]
(do [! meta.monad]
@@ -1525,7 +1525,7 @@
(def (with_return_maybe member never_null? unboxed return_term)
(-> Import_Member_Declaration Bit (Type Value) Code Code)
- (case member
+ (when member
(^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
(cond (or never_null?
(dictionary.key? ..boxes unboxed))
@@ -1548,7 +1548,7 @@
(with_template [<name> <tag> <term_trans>]
[(def (<name> member return_term)
(-> Import_Member_Declaration Code Code)
- (case member
+ (when member
(^.or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]})
(if (the <tag> commons)
<term_trans>
@@ -1565,7 +1565,7 @@
[(def (<name> mode [unboxed raw])
(-> Primitive_Mode [(Type Value) Code] Code)
(let [[unboxed refined post] (.is [(Type Value) Code (List Code)]
- (case mode
+ (when mode
{#ManualPrM}
[unboxed raw (list)]
@@ -1586,13 +1586,13 @@
(` ("jvm object cast" (, raw)))
raw)
(list)]))))
- unboxed/boxed (case (dictionary.value unboxed ..boxes)
+ unboxed/boxed (when (dictionary.value unboxed ..boxes)
{.#Some boxed}
(<unbox/box> unboxed boxed refined)
{.#None}
refined)]
- (case post
+ (when post
{.#End}
unboxed/boxed
@@ -1656,12 +1656,12 @@
(def (member_def_interop vars kind class [arg_function_inputs input_jvm_types arg_types] member method_prefix import_format)
(-> (List (Type Var)) Class_Kind (Type Declaration) [(List [Bit Code]) (List (Type Value)) (List Code)] Import_Member_Declaration Text Text (Meta (List Code)))
(let [[full_name class_tvars] (parser.declaration class)]
- (case member
+ (when member
{#EnumDecl enum_members}
(with_symbols [g!_]
(do meta.monad
[.let [enum_type (.is Code
- (case class_tvars
+ (when class_tvars
{.#End}
(` (.Primitive (, (code.text full_name))))
@@ -1704,13 +1704,13 @@
(open "[0]") commons
(open "[0]") method
[jvm_op object_ast] (.is [Text (List Code)]
- (case #import_member_kind
+ (when #import_member_kind
{#StaticIMK}
["jvm member invoke static"
(list)]
{#VirtualIMK}
- (case kind
+ (when kind
{#Class}
["jvm member invoke virtual"
(list g!obj)]
@@ -1734,7 +1734,7 @@
(list.zipped_2 input_jvm_types)
(list#each ..decorate_input))))))
jvm_interop (.is Code
- (case (jvm.void? method_return)
+ (when (jvm.void? method_return)
{.#Left method_return}
(|> [method_return
callC]
@@ -1805,7 +1805,7 @@
(` ((,' in) (.list (.` (, getter_body))))))]
(list (` (def (, g!name)
(syntax ((, g!name) [(, write|read) (, parser)])
- (case (, write|read)
+ (when (, write|read)
(,* write)
(,* read))))))))))
)))
@@ -1835,7 +1835,7 @@
(def (class_kind declaration)
(-> (Type Declaration) (Meta Class_Kind))
(let [[class_name _] (parser.declaration declaration)]
- (case (load_class class_name)
+ (when (load_class class_name)
{.#Right class}
(at meta.monad in (if (interface? class)
{#Interface}
@@ -1890,11 +1890,11 @@
(-> Type_Context .Type (Meta (Type Value)))
(if (type#= .Any type)
(at meta.monad in $Object)
- (case type
+ (when type
{.#Primitive name params}
(`` (cond (,, (with_template [<type>]
[(text#= (..reflection <type>) name)
- (case params
+ (when params
{.#End}
(at meta.monad in <type>)
@@ -1912,7 +1912,7 @@
(,, (with_template [<type>]
[(text#= (..reflection (jvm.array <type>)) name)
- (case params
+ (when params
{.#End}
(at meta.monad in (jvm.array <type>))
@@ -1929,7 +1929,7 @@
[jvm.char]))
(text#= array.primitive name)
- (case params
+ (when params
{.#Item {.#Apply writeLT {.#Apply readLT _Mutable}} {.#End}}
(at meta.monad each jvm.array
(lux_type->jvm_type context readLT))
@@ -1938,7 +1938,7 @@
<failure>)
(text.starts_with? descriptor.array_prefix name)
- (case params
+ (when params
{.#End}
(let [[_ unprefixed] (maybe.trusted (text.split_by descriptor.array_prefix name))]
(at meta.monad each jvm.array
@@ -1954,7 +1954,7 @@
(function (_ paramLT)
(do meta.monad
[paramJT (lux_type->jvm_type context paramLT)]
- (case (parser.parameter? paramJT)
+ (when (parser.parameter? paramJT)
{.#Some paramJT}
(in paramJT)
@@ -1963,7 +1963,7 @@
params)))))
{.#Apply A F}
- (case (type.applied (list A) F)
+ (when (type.applied (list A) F)
{.#None}
<failure>
@@ -1974,7 +1974,7 @@
(lux_type->jvm_type context type')
{.#Var @it}
- (case (check.result context (check.peek @it))
+ (when (check.result context (check.peek @it))
{try.#Success {.#Some :it:}}
(lux_type->jvm_type context :it:)
@@ -1986,7 +1986,7 @@
(def .public length
(syntax (_ [array <code>.any])
- (case array
+ (when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
@@ -2023,7 +2023,7 @@
(def .public read!
(syntax (_ [idx <code>.any
array <code>.any])
- (case array
+ (when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
@@ -2063,7 +2063,7 @@
(syntax (_ [idx <code>.any
value <code>.any
array <code>.any])
- (case array
+ (when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
@@ -2116,7 +2116,7 @@
(def .public is
(syntax (_ [type (..type^ (list))
object <code>.any])
- (case [(parser.array? type)
+ (when [(parser.array? type)
(parser.class? type)]
(^.or [{.#Some _} _] [_ {.#Some _}])
(in (list (` (.is (, (..value_type {#ManualPrM} type))