aboutsummaryrefslogtreecommitdiff
path: root/lux-lua/source
diff options
context:
space:
mode:
Diffstat (limited to 'lux-lua/source')
-rw-r--r--lux-lua/source/program.lux44
1 files changed, 22 insertions, 22 deletions
diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux
index a98f18507..3292b7feb 100644
--- a/lux-lua/source/program.lux
+++ b/lux-lua/source/program.lux
@@ -185,7 +185,7 @@
(def (read_variant read host_object)
(-> Translator net/sandius/rembulan/impl/DefaultTable (Try Any))
- (case [(net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_tag_field) host_object)
+ (when [(net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_tag_field) host_object)
(net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_flag_field) host_object)
(net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_value_field) host_object)]
(^.multi [{.#Some tag} ?flag {.#Some value}]
@@ -196,7 +196,7 @@
ffi.as_long
java/lang/Long::intValue
(is java/lang/Integer)))
- (is Any (case ?flag
+ (is Any (when ?flag
{.#Some _} (is Any "")
{.#None} (as Any (ffi.null))))
(is Any value)]}
@@ -212,12 +212,12 @@
output (is (Array java/lang/Object)
(array.empty init_num_keys))])
(if (n.< num_keys idx)
- (case (net/sandius/rembulan/Table::get_idx (ffi.as_long (.int (++ idx))) host_object)
+ (when (net/sandius/rembulan/Table::get_idx (ffi.as_long (.int (++ idx))) host_object)
{.#None}
(again num_keys (++ idx) output)
{.#Some member}
- (case (read member)
+ (when (read member)
{try.#Success parsed_member}
(again num_keys (++ idx) (array.has! idx (as java/lang/Object parsed_member) output))
@@ -232,7 +232,7 @@
(`` (<| (if (ffi.null? host_object)
(exception.except ..nil_has_no_lux_representation []))
(,, (with_template [<class> <post_processing>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some typed_object}
(|> typed_object <post_processing>)
@@ -246,9 +246,9 @@
[net/sandius/rembulan/ByteString (<| {try.#Success} net/sandius/rembulan/ByteString::decode)]
[net/sandius/rembulan/runtime/LuaFunction {try.#Success}]
))
- (case (ffi.as net/sandius/rembulan/impl/DefaultTable host_object)
+ (when (ffi.as net/sandius/rembulan/impl/DefaultTable host_object)
{.#Some typed_object}
- (case (read_variant read typed_object)
+ (when (read_variant read typed_object)
{try.#Failure error}
(read_tuple read typed_object)
@@ -296,7 +296,7 @@
[input/* (monad.each ! ..read parameters)]
(loop (again [lux_function abstraction
input/* input/*])
- (`` (`` (case input/*
+ (`` (`` (when input/*
(list)
(in self)
@@ -395,11 +395,11 @@
(net/sandius/rembulan/impl/DefaultTable
[] (rawget self [field java/lang/Object])
java/lang/Object
- (case (ffi.as net/sandius/rembulan/ByteString field)
+ (when (ffi.as net/sandius/rembulan/ByteString field)
{.#Some field}
- (case (ffi.of_string (net/sandius/rembulan/ByteString::decode field))
+ (when (ffi.of_string (net/sandius/rembulan/ByteString::decode field))
runtime.variant_tag_field
- (case (array.item 0 value)
+ (when (array.item 0 value)
{.#Some it}
(|> it
(as java/lang/Integer)
@@ -409,7 +409,7 @@
(undefined))
runtime.variant_flag_field
- (case (array.item 1 value)
+ (when (array.item 1 value)
{.#Some _}
(as java/lang/Object "")
@@ -433,9 +433,9 @@
(panic! (exception.error ..unknown_kind_of_object [(as java/lang/Object field)])))
{.#None}
- (case (ffi.as java/lang/Long field)
+ (when (ffi.as java/lang/Long field)
{.#Some idx}
- (case (array.item (|> idx ffi.of_long .nat --) value)
+ (when (array.item (|> idx ffi.of_long .nat --) value)
{.#Some it}
(to_host it)
@@ -479,9 +479,9 @@
(def (expander to_host baggage macro inputs lux)
(-> (-> Any java/lang/Object) Baggage Expander)
- (case (..ensure_function macro)
+ (when (..ensure_function macro)
{.#Some macro}
- (case (..call_macro to_host baggage inputs lux macro)
+ (when (..call_macro to_host baggage inputs lux macro)
{try.#Success output}
(|> output
(as (Try [Lux (List Code)]))
@@ -530,10 +530,10 @@
(all _.then
(_.when (_.or (_.< (_.int +0) $v)
(_.> (!int "10FFFF") $v))
- (_.statement (_.error/2 (|> (_.string "bad argument #")
- (_.concat $k)
- (_.concat (_.string " to char (out of range)")))
- (_.int +2))))
+ (_.statement (_.error/2 (|> (_.string "bad argument #")
+ (_.concat $k)
+ (_.concat (_.string " to char (out of range)")))
+ (_.int +2))))
(<| (_.if (_.< (!int "80") $v)
... Single-byte sequence
(_.statement (|> (_.var "string.char")
@@ -702,7 +702,7 @@
[lua_function (net/sandius/rembulan/load/ChunkLoader::loadTextChunk variable (ffi.as_string "lux compilation") (ffi.as_string (_.code code)) loader)
output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context (as java/lang/Object lua_function) (array.empty 0)
executor)]
- (case (array.item 0 output)
+ (when (array.item 0 output)
{.#None}
(in [])
@@ -784,7 +784,7 @@
(with_expansions [<jvm> (these (def (to_host it)
(-> Any java/lang/Object)
(`` (<| (,, (with_template [<jvm> <lua>]
- [(case (ffi.as <jvm> (as java/lang/Object it))
+ [(when (ffi.as <jvm> (as java/lang/Object it))
{.#Some it}
(as java/lang/Object
(<lua> [(as_expected it)]))